You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Thrinadh Kuppili <th...@gmail.com> on 2016/04/13 19:23:57 UTC
How to search for a First, Last of contact which are stored in
differnet multivalued fields
Hi,
I have created 2 multivalued fields FirstName, Lastname
In solr the values available are :
FirstName": [ "Kim", "Jake","NATALIE", "Tammey"]
LastName": [ "Lara", "Sharan","Taylor", "Taylor"]
I am trying to search where firstName is Tammey and LastName is Taylor.
I should be able to search firstname [4] and lastname [4] and get the
record
but currently it is searching with the firstname [4] and lastname [3] which
shouldn't not happen.
Do let me know if more details are needed.
Thnx
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Thrinadh Kuppili <th...@gmail.com>.
Thank you Eric
Will try it and let you know.
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901p4270192.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Erick Erickson <er...@gmail.com>.
String fields are unanalyzed so this simply will not work. String
fields are case sensitive, don't split on whitespace or non-letters
etc.
You might get significant mileage out of the admin/analysis page to
see exactly what tokenizations occur. Your original question implied
you were looking for complete names. For partial fields you need
analyzed terms.
Try the multiValued approach with positionIncrementGap then. And also
consider complexPhraseQueryParser, it handles things like "jam* cook"
where the usual parsers don't.
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-ComplexPhraseQueryParser
Best,
Erick
On Wed, Apr 13, 2016 at 4:54 PM, Thrinadh Kuppili
<th...@gmail.com> wrote:
> Thanks Eric,
>
> It tried by indexing with one multivalued field as name but I am not getting
> the expected result, below are the stored data and query to fetch from solr
>
> Name: James_Cook
>
> fq = name:Jam*
>
> I should be able to search using first name (james) or Last name ( cook) or
> partial names (jam or coo)
> so I appended * before searching .
>
> The field Name is defined as sol.strfield with no filters/tokenizer's.
>
> Thnx
> Thrinadh
>
>
>
>
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901p4270011.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Thrinadh Kuppili <th...@gmail.com>.
Thanks Eric,
It tried by indexing with one multivalued field as name but I am not getting
the expected result, below are the stored data and query to fetch from solr
Name: James_Cook
fq = name:Jam*
I should be able to search using first name (james) or Last name ( cook) or
partial names (jam or coo)
so I appended * before searching .
The field Name is defined as sol.strfield with no filters/tokenizer's.
Thnx
Thrinadh
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901p4270011.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Erick Erickson <er...@gmail.com>.
multivalued fields (parallel) simply do not support this type of
search. You'd have to do something like index kim_lara, jake_sharan,
natalie_taylor etc then search for those terms.
A more general option is to put these in a multiValued field "name",
with a positionIncrementGap of, say, 10. Now searching for phrases
will find these, as "kim lara", which would also match "kim a lara"
assuming you searched with a "slop" of 2.
you won't get matches across names as long as the slop is < 10 due to
positionIncrementGap.
Best,
Erick
On Wed, Apr 13, 2016 at 10:23 AM, Thrinadh Kuppili
<th...@gmail.com> wrote:
> Hi,
>
> I have created 2 multivalued fields FirstName, Lastname
>
> In solr the values available are :
> FirstName": [ "Kim", "Jake","NATALIE", "Tammey"]
> LastName": [ "Lara", "Sharan","Taylor", "Taylor"]
>
> I am trying to search where firstName is Tammey and LastName is Taylor.
>
> I should be able to search firstname [4] and lastname [4] and get the
> record
> but currently it is searching with the firstname [4] and lastname [3] which
> shouldn't not happen.
>
> Do let me know if more details are needed.
>
> Thnx
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Jack Krupansky <ja...@gmail.com>.
I was also going to point out the field masking span query, but... also
that it is at the Lucene level and not surfaced in Solr:
http://lucene.apache.org/core/6_0_0/core/org/apache/lucene/search/spans/FieldMaskingSpanQuery.html
Also see:
https://issues.apache.org/jira/browse/LUCENE-1494
But no hint anywhere that I know of for how to surface this Lucene feature
in Solr.
I would suggest the workaround of using an update processor to combine the
first and last names into a single multivalues field.
-- Jack Krupansky
On Wed, Apr 13, 2016 at 4:20 PM, Ahmet Arslan <io...@yahoo.com.invalid>
wrote:
> Hi Thrinadh,
>
> I think you can pull something together with FieldMaskingSpanQuery
>
> http://blog.griddynamics.com/2011/07/solr-experience-search-parent-child.html
>
> Ahmet
>
>
>
> On Wednesday, April 13, 2016 8:24 PM, Thrinadh Kuppili <
> thrinadh436@gmail.com> wrote:
> Hi,
>
> I have created 2 multivalued fields FirstName, Lastname
>
> In solr the values available are :
> FirstName": [ "Kim", "Jake","NATALIE", "Tammey"]
> LastName": [ "Lara", "Sharan","Taylor", "Taylor"]
>
> I am trying to search where firstName is Tammey and LastName is Taylor.
>
> I should be able to search firstname [4] and lastname [4] and get the
> record
> but currently it is searching with the firstname [4] and lastname [3] which
> shouldn't not happen.
>
> Do let me know if more details are needed.
>
> Thnx
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Thrinadh Kuppili <th...@gmail.com>.
I will look into it. Thanks.
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901p4270013.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to search for a First, Last of contact which are stored in
differnet multivalued fields
Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Hi Thrinadh,
I think you can pull something together with FieldMaskingSpanQuery
http://blog.griddynamics.com/2011/07/solr-experience-search-parent-child.html
Ahmet
On Wednesday, April 13, 2016 8:24 PM, Thrinadh Kuppili <th...@gmail.com> wrote:
Hi,
I have created 2 multivalued fields FirstName, Lastname
In solr the values available are :
FirstName": [ "Kim", "Jake","NATALIE", "Tammey"]
LastName": [ "Lara", "Sharan","Taylor", "Taylor"]
I am trying to search where firstName is Tammey and LastName is Taylor.
I should be able to search firstname [4] and lastname [4] and get the
record
but currently it is searching with the firstname [4] and lastname [3] which
shouldn't not happen.
Do let me know if more details are needed.
Thnx
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-search-for-a-First-Last-of-contact-which-are-stored-in-differnet-multivalued-fields-tp4269901.html
Sent from the Solr - User mailing list archive at Nabble.com.