You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by "Bowles, Mickey" <Mi...@AftonChemical.com> on 2016/05/20 13:12:07 UTC
Searching on analyed fields with a number as a string
I need to use the MultiFieldQueryParser to look through 82 fields during a search. Everything runs well with a few sminor exceptions. One large exception, though, is a Field called Type which housed an Enum's int value as a string. If we query like so "Type:5" we get no results, although there are plenty of them as seen in the result from other searches.
Is there a way to search on a field in that format? We have 9 "Types" and would like to do things like:
Query string = "joe smith and Type:5 and Type:6"
Thanks,
Mickey
RE: Searching on analyed fields with a number as a string
Posted by "Bowles, Mickey" <Mi...@AftonChemical.com>.
Turns out changing the stored value to the enum's string provided not only, a better outcome but a more logical search term Type:Chemical
Thanks
-----Original Message-----
From: Christian Johansson [mailto:Christian.Johansson@shpension.se]
Sent: Friday, May 20, 2016 9:56 AM
To: user@lucenenet.apache.org
Subject: Re: Searching on analyed fields with a number as a string
Does searching for only Type:5 works?
Try "and" in uppercase
Skickat från min iPhone
> 20 maj 2016 kl. 15:49 skrev Itamar Syn-Hershko <it...@code972.com>:
>
> How did you index those enums? try looking at the index terms to
> figure out what's going on
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant Lucene.NET committer and PMC member
>
> On Fri, May 20, 2016 at 4:12 PM, Bowles, Mickey <
> Mickey.Bowles@aftonchemical.com> wrote:
>
>> I need to use the MultiFieldQueryParser to look through 82 fields
>> during a search. Everything runs well with a few sminor exceptions.
>> One large exception, though, is a Field called Type which housed an
>> Enum's int value as a string. If we query like so "Type:5" we get
>> no results, although there are plenty of them as seen in the result from other searches.
>>
>> Is there a way to search on a field in that format? We have 9
>> "Types" and would like to do things like:
>>
>> Query string = "joe smith and Type:5 and Type:6"
>>
>> Thanks,
>>
>> Mickey
>>
Re: Searching on analyed fields with a number as a string
Posted by Christian Johansson <Ch...@shpension.se>.
Does searching for only Type:5 works?
Try "and" in uppercase
Skickat från min iPhone
> 20 maj 2016 kl. 15:49 skrev Itamar Syn-Hershko <it...@code972.com>:
>
> How did you index those enums? try looking at the index terms to figure out
> what's going on
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant
> Lucene.NET committer and PMC member
>
> On Fri, May 20, 2016 at 4:12 PM, Bowles, Mickey <
> Mickey.Bowles@aftonchemical.com> wrote:
>
>> I need to use the MultiFieldQueryParser to look through 82 fields during a
>> search. Everything runs well with a few sminor exceptions. One large
>> exception, though, is a Field called Type which housed an Enum's int value
>> as a string. If we query like so "Type:5" we get no results, although
>> there are plenty of them as seen in the result from other searches.
>>
>> Is there a way to search on a field in that format? We have 9 "Types" and
>> would like to do things like:
>>
>> Query string = "joe smith and Type:5 and Type:6"
>>
>> Thanks,
>>
>> Mickey
>>
Re: Searching on analyed fields with a number as a string
Posted by Itamar Syn-Hershko <it...@code972.com>.
How did you index those enums? try looking at the index terms to figure out
what's going on
--
Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Lucene.NET committer and PMC member
On Fri, May 20, 2016 at 4:12 PM, Bowles, Mickey <
Mickey.Bowles@aftonchemical.com> wrote:
> I need to use the MultiFieldQueryParser to look through 82 fields during a
> search. Everything runs well with a few sminor exceptions. One large
> exception, though, is a Field called Type which housed an Enum's int value
> as a string. If we query like so "Type:5" we get no results, although
> there are plenty of them as seen in the result from other searches.
>
> Is there a way to search on a field in that format? We have 9 "Types" and
> would like to do things like:
>
> Query string = "joe smith and Type:5 and Type:6"
>
> Thanks,
>
> Mickey
>