Lasitha,

I think I understand what you are asking and if you have something like
Doc1 = software engineering
Doc2 = Software engineer

And if you query
q=software+engineer -> Doc1 & Doc2

but

q="software+engineer" -> Doc1

Correct?

If this is correct then to my knowledge no, Solr out of the box cannot do
what you are asking, that is recognize a exact (quoted) search and change
the query fields to non-ngram fields. Of course you could do this in code
with some regex to see if the first and last character are double quotes
but there are a number of draw backs to this like q= "Software Engineer"
and Ninja wont do what you want it to but you could always do something
else.

>From my experience I would still want q="software+engineer" -> Doc1 and
Doc2 cause technically that exact phrase does exists in both Docs.

Maybe there is someone else on here who can offer some more perspective on
this or a possible query analyzer that I haven't heard of that can solve
this issue (I would also be interested in that).

Nick

On Thu, May 5, 2016 at 6:33 PM, Lasitha Wattaladeniya <watt...@gmail.com>
wrote:

> Hi nd,
>
> Here's the issue..  Let's say I search.. Software Engineer. For am example
> lets say this query will return 10 results when search against ngram field
> . Now I search "Software Engineer"   with double quotations. This should
> not return same result set as the previous query.
>
> I thought the query parser I'm using (edismax)  may have an inbuilt
> function for that.
>
> Do I have to specifically change the query field (qf)  to solve this issue
> for each query?
> On 6 May 2016 8:26 am, "ND" <ndrake0...@gmail.com> wrote:
>
> We implemented something similar it sounds to what you are asking but I
> dont see why you would need to match the original field. Since technically
> a field that has *software engineer* indexed is matched by a query like
> "software eng" .... to "software engineer" with the ngrams; which makes the
> exact phrase is still valid.
>
> The problem we where trying to solve was the exact phrase issue which can
> be solved with taking in a qs value of 0 (or higher depending on your
> definition of exactness).
>
> Maybe an example would help if there is something I am not understanding.
>
> Also your field definitions might help or a example of the schema breakdown
> similar to the admin analyze page.
>
> Nick
>
>
> On Thu, May 5, 2016 at 12:25 AM, Lasitha Wattaladeniya <watt...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > I'm trying to implement a search functionality using solr. Currently I'm
> > suing edismax parser with ngram fields to do the search against. So far
> it
> > works well.
> >
> > The question I have is when the user input double quotations to the
> search,
> > As the requirement this should  match against the original field, not
> > against the ngram field.
> >
> > Currently what I have thought of doing is, identify the double quotations
> > in the user input and change the query field (qf) according to that (to
> > ngram field or to the exact field). Isn't there any out of the box
> solution
> > for this, I feel like it's a generic requirement and don't want to
> reinvent
> > the wheel. Appreciate your comments
> >
> > [1]. https://issues.apache.org/jira/browse/SOLR-6842
> >
> > [2].
> >
> >
>
> http://grokbase.com/t/lucene/solr-user/14cbghncvh/different-fields-for-user-supplied-phrases-in-edismax
> >
> > Thanks,
> >
> > Lasitha Wattaladeniya
> >
> > Software Engineer
> >
>

Reply via email to