lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: search on a field by a single word
Date Wed, 11 Feb 2015 13:39:26 GMT
If you only ever want to retrieve based on exact match you could index
the name field using org.apache.lucene.document.StringField.  Do be
aware that it is exact: if you do nothing else, a search for "a" will
not match "A" or "A ".

Or you could so something with start and end markers e.g. index your
documents as something like "STARTMARKER a b c ENDMARKER" and search
using a phrase or span query including the markers.


--
Ian.



On Wed, Feb 11, 2015 at 7:55 AM, wangdong <hrdxwandg@gmail.com> wrote:
> Hi folks
>
> I have a question as follows:
>
> suppose there are 3 document in field "name":
> 1) a b c
> 2) a b
> 3) a
>
> I just want to retrival doc 3) only. I try to use syntax like this:
> name:"a"
> but I find it is not correct.is there any way to solve my question.
>
> please help me!
> thanks ahead!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message