Two field phrase search

2018-11-22 Thread NewMelchizedec sundararaj
Hi Fellow Searchers,

I am indexing some content (say name) in to two fields with different
analyzer chains.  One that would do edge prefix and the other regular
tokenization.
Let me call them name_prefix and name_term

When an incoming partial query comes up, like "steve jo", I want the
first word to be searched in regular index while the jo to go to
prefix index.

something like
name_term:steve AND name_prefix:jo

works.

But I would like to use them in a phrase. i.e. expect them to be next
to each other.  Following are the things attempted. with out success.

1. regular phrase: "name_term:steve name_prefix:jo"  - does not expect
field names.
2. complex phrase query: {!complexphrase inOrder=true}"name_term:steve
name_prefix:jo" - does not allow different field names in the same
phrase.
3. played around with {!surround}3w(name_term:steve,name_prefix:jo) -
does not support subquery (field names).

Any other way this can be accomplished?

Thanks
Melchi


Re: Two field phrase search

2018-11-23 Thread NewMelchizedec sundararaj
Thanks Erick for your inputs,

Yes, i was indeed looking for this.  I was little worried about the *
expansion.  As it is already part of a large query.  But this sounds like
the simplest way I can achieve this for now.
If I indeed slows down, will revisit this.

Was wondering if some how I can create a spanterm from different fields, I
should be able to position limit them using span aware parsers.  Sorry, if
I am just day dreaming.

Thanks
Melchi


On Fri, 23 Nov 2018 at 08:18, Erick Erickson 
wrote:

> There's no capability in Solr to do this. Given that different fields
> have different analyzer chains, how would position information be
> preserved across two fields? It'd be tricky at best.
>
> ComplexPhrase should do what you want by itself, assuming you want
> matches for any doc with "steve jobs", "steve johns", "steve johnson"
> etc.. Just search for name_term:"steve jo*"
>
> Best,
> Erick
> On Thu, Nov 22, 2018 at 4:37 PM NewMelchizedec sundararaj
>  wrote:
> >
> > Hi Fellow Searchers,
> >
> > I am indexing some content (say name) in to two fields with different
> > analyzer chains.  One that would do edge prefix and the other regular
> > tokenization.
> > Let me call them name_prefix and name_term
> >
> > When an incoming partial query comes up, like "steve jo", I want the
> > first word to be searched in regular index while the jo to go to
> > prefix index.
> >
> > something like
> > name_term:steve AND name_prefix:jo
> >
> > works.
> >
> > But I would like to use them in a phrase. i.e. expect them to be next
> > to each other.  Following are the things attempted. with out success.
> >
> > 1. regular phrase: "name_term:steve name_prefix:jo"  - does not expect
> > field names.
> > 2. complex phrase query: {!complexphrase inOrder=true}"name_term:steve
> > name_prefix:jo" - does not allow different field names in the same
> > phrase.
> > 3. played around with {!surround}3w(name_term:steve,name_prefix:jo) -
> > does not support subquery (field names).
> >
> > Any other way this can be accomplished?
> >
> > Thanks
> > Melchi
>


--


Re: Two field phrase search

2018-11-23 Thread NewMelchizedec sundararaj
Hi Alex,

Thanks for your reply.  I am keeping the original with the edge, but not
sure how to mark them as original.  I would like to avoid a prefix match
for the full words.
You mentioned post-filter - can you shed some light on this?.  If only I
can remove these over-matches, that would be great.

My requirement is even more involved than my question.  say I have a set of
analyser chains
1. token
2. edgeNgram
3. phonetic
etc

I wanted to match every token against say these analyzed fields with
different weight, but never double counting their match for the same
token.  So I am wrapping them in a {!maxscore}.

In addition to this, I would like to maintain the proximity of the tokens
to one another (at least maintaining the proximity less than the
positionIncrementGap to remain with in a single value of a multi-valued
field).

Regards
Melchi


On Fri, 23 Nov 2018 at 17:54, Alexandre Rafalovitch 
wrote:

> It is not clear how much flexibility you expect in those queries. Can
> the second word never be full name? Can there be more than 2 words?
> How do you know the length of the prefix? When you say prefix, do you
> mean 'jo' is expected to match 'joseph'?
>
> So, just generically, I would say why not index everything into one
> field with analyzer chain keeping both original and prefixed
> (EdgeNGrams) forms of the word? Maybe combined with some sort of
> post-filter if that over-matches.
>
> Regards,
>    Alex.
> On Thu, 22 Nov 2018 at 19:37, NewMelchizedec sundararaj
>  wrote:
> >
> > Hi Fellow Searchers,
> >
> > I am indexing some content (say name) in to two fields with different
> > analyzer chains.  One that would do edge prefix and the other regular
> > tokenization.
> > Let me call them name_prefix and name_term
> >
> > When an incoming partial query comes up, like "steve jo", I want the
> > first word to be searched in regular index while the jo to go to
> > prefix index.
> >
> > something like
> > name_term:steve AND name_prefix:jo
> >
> > works.
> >
> > But I would like to use them in a phrase. i.e. expect them to be next
> > to each other.  Following are the things attempted. with out success.
> >
> > 1. regular phrase: "name_term:steve name_prefix:jo"  - does not expect
> > field names.
> > 2. complex phrase query: {!complexphrase inOrder=true}"name_term:steve
> > name_prefix:jo" - does not allow different field names in the same
> > phrase.
> > 3. played around with {!surround}3w(name_term:steve,name_prefix:jo) -
> > does not support subquery (field names).
> >
> > Any other way this can be accomplished?
> >
> > Thanks
> > Melchi
>


--


Re: Two field phrase search

2018-11-23 Thread NewMelchizedec sundararaj
Thanks Mikhail,

I will check this FieldMaskingSpanQuery out.

Thanks
Melchi
On Fri, 23 Nov 2018 at 19:17, Mikhail Khludnev  wrote:
>
> There's no way to search with positions across other fields. I can only
> recommend to prepend prefix terms to distinguish them.
> But hold on, what about FieldMaskingSpanQuery? It's available in
> XMLQparser, you may try.
>
> On Fri, Nov 23, 2018 at 3:37 AM NewMelchizedec sundararaj 
> wrote:
>
> > Hi Fellow Searchers,
> >
> > I am indexing some content (say name) in to two fields with different
> > analyzer chains.  One that would do edge prefix and the other regular
> > tokenization.
> > Let me call them name_prefix and name_term
> >
> > When an incoming partial query comes up, like "steve jo", I want the
> > first word to be searched in regular index while the jo to go to
> > prefix index.
> >
> > something like
> > name_term:steve AND name_prefix:jo
> >
> > works.
> >
> > But I would like to use them in a phrase. i.e. expect them to be next
> > to each other.  Following are the things attempted. with out success.
> >
> > 1. regular phrase: "name_term:steve name_prefix:jo"  - does not expect
> > field names.
> > 2. complex phrase query: {!complexphrase inOrder=true}"name_term:steve
> > name_prefix:jo" - does not allow different field names in the same
> > phrase.
> > 3. played around with {!surround}3w(name_term:steve,name_prefix:jo) -
> > does not support subquery (field names).
> >
> > Any other way this can be accomplished?
> >
> > Thanks
> > Melchi
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev



--