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 "Prasanna S. Dhakephalkar" <pr...@merajob.in> on 2015/10/12 09:47:08 UTC

How to formulate query

Hi,

 

I am trying to make a solr search query to get result as under I am unable
to get do

 

I have a search term say "pit"

The result should have (in that order)

 

All docs that have "pit" as first WORD in search field  (pit\ *)+

All docs that have first WORD that starts with "pit"  (pit*\  *)+

All docs that have "pit" as WORD anywhere in search field  (except first)
(*\ pit\ *)+

All docs that have  a WORD starting with "pit" anywhere in search field
(except first) (*\ pit*\ *)+

All docs that have "pit" as string anywhere in the search field except cases
covered above (*pit*)

 

Example :

 

Pit the pat 

Pit digger

Pitch ball

Pitcher man

Dig a pit with shovel

Why do you want to dig a pit with shovel

Cricket pitch is 22 yards

What is pithy, I don't know

Per capita income

Epitome of blah blah

 

 

How can I achieve this ?

 

Regards,

 

Prasanna.

 


RE: How to formulate query

Posted by "Prasanna S. Dhakephalkar" <pr...@merajob.in>.
Hi Susheel, Mikhail, Erick,

Thanks for replies.

I need to learn more.

Regards,

Prasanna.

-----Original Message-----
From: Susheel Kumar [mailto:susheel2777@gmail.com] 
Sent: Tuesday, October 13, 2015 12:54 AM
To: solr-user@lucene.apache.org
Subject: Re: How to formulate query

Hi Prassana, This is a highly custom relevancy/ordering requirement and one possible way you can try is by creating multiple fields and coming up with query for each of the searches and boost them accordingly.

Thnx

On Mon, Oct 12, 2015 at 12:50 PM, Erick Erickson <er...@gmail.com>
wrote:

> Nothing exists currently that would do this. I would urge you to 
> revisit the requirements, this kind of super-specific ordering is 
> often not worth the effort to try to enforce, how does the _user_ 
> benefit here?
>
> Best,
> Erick
>
> On Mon, Oct 12, 2015 at 12:47 AM, Prasanna S. Dhakephalkar 
> <pr...@merajob.in> wrote:
> > Hi,
> >
> >
> >
> > I am trying to make a solr search query to get result as under I am
> unable
> > to get do
> >
> >
> >
> > I have a search term say "pit"
> >
> > The result should have (in that order)
> >
> >
> >
> > All docs that have "pit" as first WORD in search field  (pit\ *)+
> >
> > All docs that have first WORD that starts with "pit"  (pit*\  *)+
> >
> > All docs that have "pit" as WORD anywhere in search field  (except 
> > first) (*\ pit\ *)+
> >
> > All docs that have  a WORD starting with "pit" anywhere in search 
> > field (except first) (*\ pit*\ *)+
> >
> > All docs that have "pit" as string anywhere in the search field 
> > except
> cases
> > covered above (*pit*)
> >
> >
> >
> > Example :
> >
> >
> >
> > Pit the pat
> >
> > Pit digger
> >
> > Pitch ball
> >
> > Pitcher man
> >
> > Dig a pit with shovel
> >
> > Why do you want to dig a pit with shovel
> >
> > Cricket pitch is 22 yards
> >
> > What is pithy, I don't know
> >
> > Per capita income
> >
> > Epitome of blah blah
> >
> >
> >
> >
> >
> > How can I achieve this ?
> >
> >
> >
> > Regards,
> >
> >
> >
> > Prasanna.
> >
> >
> >
>


Re: How to formulate query

Posted by Susheel Kumar <su...@gmail.com>.
Hi Prassana, This is a highly custom relevancy/ordering requirement and one
possible way you can try is by creating multiple fields and coming up with
query for each of the searches and boost them accordingly.

Thnx

On Mon, Oct 12, 2015 at 12:50 PM, Erick Erickson <er...@gmail.com>
wrote:

> Nothing exists currently that would do this. I would urge you to revisit
> the
> requirements, this kind of super-specific ordering is often not worth the
> effort to try to enforce, how does the _user_ benefit here?
>
> Best,
> Erick
>
> On Mon, Oct 12, 2015 at 12:47 AM, Prasanna S. Dhakephalkar
> <pr...@merajob.in> wrote:
> > Hi,
> >
> >
> >
> > I am trying to make a solr search query to get result as under I am
> unable
> > to get do
> >
> >
> >
> > I have a search term say "pit"
> >
> > The result should have (in that order)
> >
> >
> >
> > All docs that have "pit" as first WORD in search field  (pit\ *)+
> >
> > All docs that have first WORD that starts with "pit"  (pit*\  *)+
> >
> > All docs that have "pit" as WORD anywhere in search field  (except first)
> > (*\ pit\ *)+
> >
> > All docs that have  a WORD starting with "pit" anywhere in search field
> > (except first) (*\ pit*\ *)+
> >
> > All docs that have "pit" as string anywhere in the search field except
> cases
> > covered above (*pit*)
> >
> >
> >
> > Example :
> >
> >
> >
> > Pit the pat
> >
> > Pit digger
> >
> > Pitch ball
> >
> > Pitcher man
> >
> > Dig a pit with shovel
> >
> > Why do you want to dig a pit with shovel
> >
> > Cricket pitch is 22 yards
> >
> > What is pithy, I don't know
> >
> > Per capita income
> >
> > Epitome of blah blah
> >
> >
> >
> >
> >
> > How can I achieve this ?
> >
> >
> >
> > Regards,
> >
> >
> >
> > Prasanna.
> >
> >
> >
>

Re: How to formulate query

Posted by Erick Erickson <er...@gmail.com>.
Nothing exists currently that would do this. I would urge you to revisit the
requirements, this kind of super-specific ordering is often not worth the
effort to try to enforce, how does the _user_ benefit here?

Best,
Erick

On Mon, Oct 12, 2015 at 12:47 AM, Prasanna S. Dhakephalkar
<pr...@merajob.in> wrote:
> Hi,
>
>
>
> I am trying to make a solr search query to get result as under I am unable
> to get do
>
>
>
> I have a search term say "pit"
>
> The result should have (in that order)
>
>
>
> All docs that have "pit" as first WORD in search field  (pit\ *)+
>
> All docs that have first WORD that starts with "pit"  (pit*\  *)+
>
> All docs that have "pit" as WORD anywhere in search field  (except first)
> (*\ pit\ *)+
>
> All docs that have  a WORD starting with "pit" anywhere in search field
> (except first) (*\ pit*\ *)+
>
> All docs that have "pit" as string anywhere in the search field except cases
> covered above (*pit*)
>
>
>
> Example :
>
>
>
> Pit the pat
>
> Pit digger
>
> Pitch ball
>
> Pitcher man
>
> Dig a pit with shovel
>
> Why do you want to dig a pit with shovel
>
> Cricket pitch is 22 yards
>
> What is pithy, I don't know
>
> Per capita income
>
> Epitome of blah blah
>
>
>
>
>
> How can I achieve this ?
>
>
>
> Regards,
>
>
>
> Prasanna.
>
>
>

Re: How to formulate query

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello,
Even number of word can be used as scoring factor, but just for beginning.
You can cut the first word into separate field with _field mutating update
processor_ see
http://lucene.apache.org/solr/5_3_1/solr-core/org/apache/solr/update/processor/FieldMutatingUpdateProcessorFactory.html
then you can use query syntax to specify field:, boost^10 and wildcard*.
All such clauses might be combited with spaces as optional ones.
http://lucene.apache.org/core/5_2_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html


On Mon, Oct 12, 2015 at 12:47 AM, Prasanna S. Dhakephalkar <
prasanna.d@merajob.in> wrote:

> Hi,
>
>
>
> I am trying to make a solr search query to get result as under I am unable
> to get do
>
>
>
> I have a search term say "pit"
>
> The result should have (in that order)
>
>
>
> All docs that have "pit" as first WORD in search field  (pit\ *)+
>
> All docs that have first WORD that starts with "pit"  (pit*\  *)+
>
> All docs that have "pit" as WORD anywhere in search field  (except first)
> (*\ pit\ *)+
>
> All docs that have  a WORD starting with "pit" anywhere in search field
> (except first) (*\ pit*\ *)+
>
> All docs that have "pit" as string anywhere in the search field except
> cases
> covered above (*pit*)
>
>
>
> Example :
>
>
>
> Pit the pat
>
> Pit digger
>
> Pitch ball
>
> Pitcher man
>
> Dig a pit with shovel
>
> Why do you want to dig a pit with shovel
>
> Cricket pitch is 22 yards
>
> What is pithy, I don't know
>
> Per capita income
>
> Epitome of blah blah
>
>
>
>
>
> How can I achieve this ?
>
>
>
> Regards,
>
>
>
> Prasanna.
>
>
>
>


-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mk...@griddynamics.com>