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 Kelvin Tan <ke...@relevanz.com> on 2001/11/12 11:06:41 UTC

Recommended way of performing multi-field searches

This is a repost of a question posted to jGuru Lucene Forum. Didn't get a response there so I'm trying my luck here...

What's the recommended way of performing multi-field searches? 

  a.. Programmatically adding a :[field] for each field to the query and parsing this query? 
Thanks

Sincerely,
Kelvin Tan

Relevanz Pte Ltd
180B Bencoolen St.
The Bencoolen, #04-01
S(189648)

Tel: 238-6229

Re: Recommended way of performing multi-field searches

Posted by Kelvin Tan <ke...@relevanz.com>.
Here it is.

Feedback is most welcome.

Regards,
Kelvin
----- Original Message -----
From: Lee Mallabone <le...@grantadesign.com>
To: Lucene Users List <lu...@jakarta.apache.org>
Sent: Monday, November 12, 2001 10:12 PM
Subject: Re: Recommended way of performing multi-field searches


> On Mon, 2001-11-12 at 13:33, Kelvin Tan wrote:
> > If anyone's interested, I'd be happy to donate the code.
>
> Sounds cool - at the moment I just construct a string as some people
> suggested, but it's less than elegant. Your solution sounds like a big
> improvement.
>
> Regards,
>
> --
> Lee Mallabone
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>

Re: Recommended way of performing multi-field searches

Posted by Lee Mallabone <le...@grantadesign.com>.
On Mon, 2001-11-12 at 13:33, Kelvin Tan wrote:
> If anyone's interested, I'd be happy to donate the code.

Sounds cool - at the moment I just construct a string as some people
suggested, but it's less than elegant. Your solution sounds like a big
improvement.

Regards,

-- 
Lee Mallabone


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Recommended way of performing multi-field searches

Posted by Kelvin Tan <ke...@relevanz.com>.
I think I've addressed my little problem. What I did was extend QueryParser
and in that class, implement a method which constructs a Query based on the
appropriate fields (I tried taking a look at QueryParser.jj, but gave up
after awhile...:)

If anyone's interested, I'd be happy to donate the code.

Regards,
Kelvin

----- Original Message -----
From: Kelvin Tan <ke...@relevanz.com>
To: Lucene Users List <lu...@jakarta.apache.org>
Sent: Monday, November 12, 2001 6:51 PM
Subject: Re: Recommended way of performing multi-field searches


> I'm looking for something a little more complex.
>
> If there are say 5 fields to be searched, and the same query needs to be
> searched across x fields, do we expect the user to type out
> "{field1}:{query} {field2}:{query}{field3}:{query} ...{fieldx}:{query}" ?
I
> think not...
>
> Which means that we've to implement something which adds the selected
fields
> to search programmatically...
>
> I'll take a look at QueryParser.jj and see what I can come up with...
>
> ----- Original Message -----
> From: Dave Kor <da...@nexusedge.com>
> To: Lucene Users List <lu...@jakarta.apache.org>
> Sent: Monday, November 12, 2001 6:23 PM
> Subject: RE: Recommended way of performing multi-field searches
>
>
> > > This is a repost of a question posted to jGuru Lucene Forum.
> > > Didn't get a response there so I'm trying my luck here...
> > >
> > > What's the recommended way of performing multi-field searches?
> > >
> > >   a.. Programmatically adding a :[field] for each field to the
> > > query and parsing this query?
> >
> >
> > Just use the query parser, you can specify field specific searches using
> the
> > format field:text.
> > Eg, "title:cat author:james"
> >
> > Dave Kor Kian Wei
> > Consultant
> > Product Engineering
> > NexusEdge Technologies Pte. Ltd.
> > 6 Aljunied Ave 3, #01-02 (Level 4)
> > Singapore 389932
> > Tel : (+65)848-2552
> > Fax : (+65)747-4536
> > Web : www.nexusedge.com
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Recommended way of performing multi-field searches

Posted by Kelvin Tan <ke...@relevanz.com>.
I'm looking for something a little more complex.

If there are say 5 fields to be searched, and the same query needs to be
searched across x fields, do we expect the user to type out
"{field1}:{query} {field2}:{query}{field3}:{query} ...{fieldx}:{query}" ? I
think not...

Which means that we've to implement something which adds the selected fields
to search programmatically...

I'll take a look at QueryParser.jj and see what I can come up with...

----- Original Message -----
From: Dave Kor <da...@nexusedge.com>
To: Lucene Users List <lu...@jakarta.apache.org>
Sent: Monday, November 12, 2001 6:23 PM
Subject: RE: Recommended way of performing multi-field searches


> > This is a repost of a question posted to jGuru Lucene Forum.
> > Didn't get a response there so I'm trying my luck here...
> >
> > What's the recommended way of performing multi-field searches?
> >
> >   a.. Programmatically adding a :[field] for each field to the
> > query and parsing this query?
>
>
> Just use the query parser, you can specify field specific searches using
the
> format field:text.
> Eg, "title:cat author:james"
>
> Dave Kor Kian Wei
> Consultant
> Product Engineering
> NexusEdge Technologies Pte. Ltd.
> 6 Aljunied Ave 3, #01-02 (Level 4)
> Singapore 389932
> Tel : (+65)848-2552
> Fax : (+65)747-4536
> Web : www.nexusedge.com
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Errors when an update occurs while a search is under way

Posted by Anders Nielsen <an...@visator.dk>.
Hello All,

It seems I jumped the gun here, so please disregard the message below.

(There was a part of my code that didn't check whether the IndexReader I am
using, had been modified).

Venlig hilsen

Anders Nielsen
Adm. direktør

_____________

Visator ApS
Kroghsgade 1
2100 Kbh. Ø
Tlf: 35 55 47 02
Mobil: 26 71 36 63
_____________




-----Original Message-----
From: Anders Nielsen [mailto:anders@visator.dk]
Sent: 12. november 2001 11:39
To: Lucene Users List
Subject: Errors when an update occurs while a search is under way


I am getting occasional errors when I search, and it seems it is when an
update starts while the search is going on.

I have a cronjob that loads documents into the lucene index every 5 minutes,
and then I have a webserver from which users can search the index from.

Isn't there supposed to be an exclusive-lock that prohibits writing while a
search is ongoing?

the error I get is:

java.io.IOException: Bad file descriptor
        at java.io.RandomAccessFile.seek(Native Method)
        at
org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:271)
        at org.apache.lucene.store.InputStream.refill(InputStream.java:166)
        at org.apache.lucene.store.InputStream.readByte(InputStream.java:80)
        at
org.apache.lucene.store.InputStream.readVInt(InputStream.java:106)
        at
org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:127)
        at
org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:114)
        at
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:166)
        at
org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:161)
        at
org.apache.lucene.index.TermInfosReader.terms(TermInfosReader.java:217)
        at
org.apache.lucene.index.SegmentReader.terms(SegmentReader.java:183)
        at
org.apache.lucene.index.SegmentsTermEnum.<init>(SegmentsReader.java:182)
        at
org.apache.lucene.index.SegmentsReader.terms(SegmentsReader.java:144)


Venlig hilsen

Anders Nielsen
Adm. direktør

_____________

Visator ApS
Kroghsgade 1
2100 Kbh. Ø
Tlf: 35 55 47 02
Mobil: 26 71 36 63
_____________



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Errors when an update occurs while a search is under way

Posted by Anders Nielsen <an...@visator.dk>.
I am getting occasional errors when I search, and it seems it is when an
update starts while the search is going on.

I have a cronjob that loads documents into the lucene index every 5 minutes,
and then I have a webserver from which users can search the index from.

Isn't there supposed to be an exclusive-lock that prohibits writing while a
search is ongoing?

the error I get is:

java.io.IOException: Bad file descriptor
        at java.io.RandomAccessFile.seek(Native Method)
        at
org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:271)
        at org.apache.lucene.store.InputStream.refill(InputStream.java:166)
        at org.apache.lucene.store.InputStream.readByte(InputStream.java:80)
        at
org.apache.lucene.store.InputStream.readVInt(InputStream.java:106)
        at
org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:127)
        at
org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:114)
        at
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:166)
        at
org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:161)
        at
org.apache.lucene.index.TermInfosReader.terms(TermInfosReader.java:217)
        at
org.apache.lucene.index.SegmentReader.terms(SegmentReader.java:183)
        at
org.apache.lucene.index.SegmentsTermEnum.<init>(SegmentsReader.java:182)
        at
org.apache.lucene.index.SegmentsReader.terms(SegmentsReader.java:144)


Venlig hilsen

Anders Nielsen
Adm. direktør

_____________

Visator ApS
Kroghsgade 1
2100 Kbh. Ø
Tlf: 35 55 47 02
Mobil: 26 71 36 63
_____________



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Recommended way of performing multi-field searches

Posted by Dave Kor <da...@nexusedge.com>.
> This is a repost of a question posted to jGuru Lucene Forum.
> Didn't get a response there so I'm trying my luck here...
>
> What's the recommended way of performing multi-field searches?
>
>   a.. Programmatically adding a :[field] for each field to the
> query and parsing this query?


Just use the query parser, you can specify field specific searches using the
format field:text.
Eg, "title:cat author:james"

Dave Kor Kian Wei
Consultant
Product Engineering
NexusEdge Technologies Pte. Ltd.
6 Aljunied Ave 3, #01-02 (Level 4)
Singapore 389932
Tel : (+65)848-2552
Fax : (+65)747-4536
Web : www.nexusedge.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>