You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by su...@zapak.co.in on 2010/04/01 08:22:10 UTC

query: order of search

Hello


Query I
Does the order of query play role in searching 
example:doc has fields
rollno(pk), name, marks

Query : marks=90&rollno=2&name=abc

Query :rollno=2&name=abc&marks=90

which query processing will be more efficient.
is it work like search doc field by field , it will look for doc having
rollno=2 then from thos will look for name abc and from the selected docs
will again look for marks param .


Query II
 which  is more faster .
a)  adding one more multivalued field into current index(large) 
b)  or creating a separate index for the field and searching it as a
subindex .
My main apprehensions is in regard to large size of index




thanks,
Suman 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: query: order of search

Posted by Karl Wettin <ka...@gmail.com>.
1 apr 2010 kl. 11.21 skrev <su...@zapak.co.in> <suman.holani@zapak.co.in 
 >:

> its written "to do a "search within search", so that the second  
> search is
> constrained by the results of the first query"

If I understand your needs you could while collecting search results  
populate a new filter with all matching documents and use that filter  
during "search within search(results?)".


	karl

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: query: order of search

Posted by Erick Erickson <er...@gmail.com>.
I'm pretty sure that order doesn't matter. Again, though, don't
worry about this level of trick until you can demonstrate
performance issues, your time is usually best spent in other
places....

Best
Erick

On Thu, Apr 1, 2010 at 11:54 PM, <su...@zapak.co.in> wrote:

> Hello Erick,
>
> I was trying to optimise the searching.
> Basically my data is like field1 has less no of docs matching compared to
> field2, which has larget sets.
>
> So if search goes by order to order, then i can make field1 to be search
> first, (by making  order of boolean query such  )and from thr the docs
> result set could be searched for field2.
> So number of docs to be matched will be less.
> I am not using filters or any caching since the search is unique everytime
> acc to parameter, and its using boolean query
>
>
> or is the searching takes place like searches each doc for  field1="abc"
> and field2="def" then get resultset
>
> I hope I am clear in explaining my query.
>
> thanks,
> Suman
>
>
>
> On Thu, 1 Apr 2010 08:42:16 -0700, Erick Erickson
> <er...@gmail.com>
> wrote:
>  > Why do you care? By that I mean "what problem are you trying to solve"
> > (See "The XY problem at http://people.apache.org/~hossman/). The reason
> > I'm asking here is that very often, when people ask this kind of
> question
> > without providing background, they're trying the wrong approach to solve
> > a problem.
> >
> > Unless you're asking for theoretical reasons, I almost guarantee that
> > trying
> > to solve any problem in Lucene by changing the order of the clauses
> isn't
> > going to do you much good in the long run, there'll *always* be variant
> > n+1...
> >
> > Best
> > Erick
> >
> > On Thu, Apr 1, 2010 at 2:21 AM, <su...@zapak.co.in> wrote:
> >
> >>
> >> Query I
> >>
> >> its written "to do a "search within search", so that the second search
> is
> >> constrained by the results of the first query"
> >> we can use boolean query.
> >> So doesn't it mean the order of query ll be preserved
> >>
> >> give me an simple example of how the docs get searched in lucene.
> >> 10 docs with 3 fields to b searched
> >> so ll it search for field1 for all 10 docs..and the result set docs ll
> b
> >> then searched for field2....and so far...
> >> or is it something else..
> >>
> >>
> >>
> >> thanks,
> >> Suman
> >>
> >> On Thu, 1 Apr 2010 10:05:01 +0100, Ian Lea <ia...@gmail.com> wrote:
> >> >> Query I
> >> >> Does the order of query play role in searching
> >> >> example:doc has fields
> >> >> rollno(pk), name, marks
> >> >>
> >> >> Query : marks=90&rollno=2&name=abc
> >> >>
> >> >> Query :rollno=2&name=abc&marks=90
> >> >>
> >> >> which query processing will be more efficient.
> >> >> is it work like search doc field by field , it will look for doc
> >> >> having
> >> >> rollno=2 then from thos will look for name abc and from the selected
> >> docs
> >> >> will again look for marks param .
> >> >
> >> > I don't think it makes any difference.
> >> >
> >> >
> >> >> Query II
> >> >>  which  is more faster .
> >> >> a)  adding one more multivalued field into current index(large)
> >> >> b)  or creating a separate index for the field and searching it as a
> >> >> subindex .
> >> >> My main apprehensions is in regard to large size of index
> >> >
> >> > Probably your first option.
> >> >
> >> >
> >> > --
> >> > Ian.
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: query: order of search

Posted by su...@zapak.co.in.
Hello Erick,

I was trying to optimise the searching.
Basically my data is like field1 has less no of docs matching compared to
field2, which has larget sets.

So if search goes by order to order, then i can make field1 to be search
first, (by making  order of boolean query such  )and from thr the docs
result set could be searched for field2. 
So number of docs to be matched will be less.
I am not using filters or any caching since the search is unique everytime
acc to parameter, and its using boolean query


or is the searching takes place like searches each doc for  field1="abc"
and field2="def" then get resultset

I hope I am clear in explaining my query. 

thanks,
Suman



On Thu, 1 Apr 2010 08:42:16 -0700, Erick Erickson
<er...@gmail.com>
wrote:
> Why do you care? By that I mean "what problem are you trying to solve"
> (See "The XY problem at http://people.apache.org/~hossman/). The reason
> I'm asking here is that very often, when people ask this kind of
question
> without providing background, they're trying the wrong approach to solve
> a problem.
> 
> Unless you're asking for theoretical reasons, I almost guarantee that
> trying
> to solve any problem in Lucene by changing the order of the clauses
isn't
> going to do you much good in the long run, there'll *always* be variant
> n+1...
> 
> Best
> Erick
> 
> On Thu, Apr 1, 2010 at 2:21 AM, <su...@zapak.co.in> wrote:
> 
>>
>> Query I
>>
>> its written "to do a "search within search", so that the second search
is
>> constrained by the results of the first query"
>> we can use boolean query.
>> So doesn't it mean the order of query ll be preserved
>>
>> give me an simple example of how the docs get searched in lucene.
>> 10 docs with 3 fields to b searched
>> so ll it search for field1 for all 10 docs..and the result set docs ll
b
>> then searched for field2....and so far...
>> or is it something else..
>>
>>
>>
>> thanks,
>> Suman
>>
>> On Thu, 1 Apr 2010 10:05:01 +0100, Ian Lea <ia...@gmail.com> wrote:
>> >> Query I
>> >> Does the order of query play role in searching
>> >> example:doc has fields
>> >> rollno(pk), name, marks
>> >>
>> >> Query : marks=90&rollno=2&name=abc
>> >>
>> >> Query :rollno=2&name=abc&marks=90
>> >>
>> >> which query processing will be more efficient.
>> >> is it work like search doc field by field , it will look for doc
>> >> having
>> >> rollno=2 then from thos will look for name abc and from the selected
>> docs
>> >> will again look for marks param .
>> >
>> > I don't think it makes any difference.
>> >
>> >
>> >> Query II
>> >>  which  is more faster .
>> >> a)  adding one more multivalued field into current index(large)
>> >> b)  or creating a separate index for the field and searching it as a
>> >> subindex .
>> >> My main apprehensions is in regard to large size of index
>> >
>> > Probably your first option.
>> >
>> >
>> > --
>> > Ian.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> > For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: query: order of search

Posted by Erick Erickson <er...@gmail.com>.
Why do you care? By that I mean "what problem are you trying to solve"
(See "The XY problem at http://people.apache.org/~hossman/). The reason
I'm asking here is that very often, when people ask this kind of question
without providing background, they're trying the wrong approach to solve
a problem.

Unless you're asking for theoretical reasons, I almost guarantee that trying
to solve any problem in Lucene by changing the order of the clauses isn't
going to do you much good in the long run, there'll *always* be variant
n+1...

Best
Erick

On Thu, Apr 1, 2010 at 2:21 AM, <su...@zapak.co.in> wrote:

>
> Query I
>
> its written "to do a "search within search", so that the second search is
> constrained by the results of the first query"
> we can use boolean query.
> So doesn't it mean the order of query ll be preserved
>
> give me an simple example of how the docs get searched in lucene.
> 10 docs with 3 fields to b searched
> so ll it search for field1 for all 10 docs..and the result set docs ll b
> then searched for field2....and so far...
> or is it something else..
>
>
>
> thanks,
> Suman
>
> On Thu, 1 Apr 2010 10:05:01 +0100, Ian Lea <ia...@gmail.com> wrote:
> >> Query I
> >> Does the order of query play role in searching
> >> example:doc has fields
> >> rollno(pk), name, marks
> >>
> >> Query : marks=90&rollno=2&name=abc
> >>
> >> Query :rollno=2&name=abc&marks=90
> >>
> >> which query processing will be more efficient.
> >> is it work like search doc field by field , it will look for doc having
> >> rollno=2 then from thos will look for name abc and from the selected
> docs
> >> will again look for marks param .
> >
> > I don't think it makes any difference.
> >
> >
> >> Query II
> >>  which  is more faster .
> >> a)  adding one more multivalued field into current index(large)
> >> b)  or creating a separate index for the field and searching it as a
> >> subindex .
> >> My main apprehensions is in regard to large size of index
> >
> > Probably your first option.
> >
> >
> > --
> > Ian.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: query: order of search

Posted by su...@zapak.co.in.
Query I

its written "to do a "search within search", so that the second search is
constrained by the results of the first query"
we can use boolean query.
So doesn't it mean the order of query ll be preserved

give me an simple example of how the docs get searched in lucene.
10 docs with 3 fields to b searched
so ll it search for field1 for all 10 docs..and the result set docs ll b
then searched for field2....and so far...
or is it something else..



thanks,
Suman

On Thu, 1 Apr 2010 10:05:01 +0100, Ian Lea <ia...@gmail.com> wrote:
>> Query I
>> Does the order of query play role in searching
>> example:doc has fields
>> rollno(pk), name, marks
>>
>> Query : marks=90&rollno=2&name=abc
>>
>> Query :rollno=2&name=abc&marks=90
>>
>> which query processing will be more efficient.
>> is it work like search doc field by field , it will look for doc having
>> rollno=2 then from thos will look for name abc and from the selected
docs
>> will again look for marks param .
> 
> I don't think it makes any difference.
> 
> 
>> Query II
>>  which  is more faster .
>> a)  adding one more multivalued field into current index(large)
>> b)  or creating a separate index for the field and searching it as a
>> subindex .
>> My main apprehensions is in regard to large size of index
> 
> Probably your first option.
> 
> 
> --
> Ian.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: query: order of search

Posted by Ian Lea <ia...@gmail.com>.
> Query I
> Does the order of query play role in searching
> example:doc has fields
> rollno(pk), name, marks
>
> Query : marks=90&rollno=2&name=abc
>
> Query :rollno=2&name=abc&marks=90
>
> which query processing will be more efficient.
> is it work like search doc field by field , it will look for doc having
> rollno=2 then from thos will look for name abc and from the selected docs
> will again look for marks param .

I don't think it makes any difference.


> Query II
>  which  is more faster .
> a)  adding one more multivalued field into current index(large)
> b)  or creating a separate index for the field and searching it as a
> subindex .
> My main apprehensions is in regard to large size of index

Probably your first option.


--
Ian.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: query: order of search

Posted by Chris Hostetter <ho...@fucit.org>.
: Subject: query: order of search
: In-Reply-To: <8D...@transpac.com>
: References: <j2...@mail.gmail.com>
:     <8D...@transpac.com>

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is "hidden" in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/User:DonDiego/Thread_hijacking


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org