FAQ
I am having some strange behavior and want to rule out that the query that I
am constructing is the correct way to deal with this type of query. This
is what I am working with:

I am creating a query that contains 3 different fields
Field 1: value - String
Field 2: type - String
Field 3: time - Unfortunately Strings

The query will always contain the date range. The query can contain all 3
fields or at least 1 and 3.
i.e
1 & 2 & 3
1 & 3


I tried creating a BooleanQuery similiar to
BooleanQuery bq = new BooleanQuery();
bq.add(new TermQuery(new Term("value",
"hello")),BooleanClause.Occur.MUST);
bq.add(new TermQuery(new Term("type","email")),BooleanClause.Occur.MUST);

parallelSearcher.search(bq, new RangeFilter("time", startTime,
endTime,true,true),col);

TopDoccollector col = new TopDocCollector(1000);
ParallelMultiSearcher parallelSearcher = new
ParallelMultiSearcher(indexes); // 1 to many indexes

//Now I add the date range
parallelSearcher.search(bq, new RangeFilter("time", startTime,
endTime,true,true),col);


The problem is when there are no matches for the boolean part of the
query... I get an input/output error...


java.io.IOException: Input/output error
java.io.RandomAccessFile.readBytes(Native Method)
java.io.RandomAccessFile.read(RandomAccessFile.java:315)
at
org.apache.lucene.store.FSDirecotry$FSIndexInput.readInternal(FSDirectory.java:550)
at
org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedInputInput.java:131)
at
org.apache.lucene.index.CompoundFileReader$CSIndexInput.readInternal(CompoundFileReader.java:240)
at
org.apache.lucene.instoreBufferedIndexInput.refill(BufferedIndexInput.java:
152)
at
org.apache.lucene.instoreBufferedIndexInput.readByte(BufferedIndexInput.java:
152)
at org.lucene.store.IndexInput.readVInt(IndexInput.java:76)
at org.apache.lucene.index.TermBuffer.read(TermBuffer.java:63)
at org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:123)
at org.apache.lucene.index.SegmentTermEnum.scanTo(SegmentTermEnum.java:154)
at
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:223)
at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:217)
at org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:678)
at org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:87)
at org.apache.lucene.search.Searcher.docFreqs(searcher.java:118)
at
org.apache.lucene.search.MultiSearcher.createWeight(MultiSearcher.java:311)
at org.apache.lucene.search.Searcher.search(Searcher.java:178)






Thanks!
Julie

--
View this message in context: http://www.nabble.com/Newbie-Question%3A-Query-Creation-Best-Approach-tp20195065p20195065.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Search Discussions

  • Grant Ingersoll at Oct 29, 2008 at 12:44 pm
    Hmm, this strikes me as there being something wrong with the index,
    but it could be a bug, too. Do you get an error if you just run the
    BooleanQuery without the filter? How about if you run a simple
    TermQuery with the Filter? Can you open the index with Luke? Does
    the CheckIndex tool (in Lucene) provide any useful information? Also,
    what version of Lucene are you using?

    On Oct 27, 2008, at 3:52 PM, JulieSoko wrote:


    I am having some strange behavior and want to rule out that the
    query that I
    am constructing is the correct way to deal with this type of
    query. This
    is what I am working with:

    I am creating a query that contains 3 different fields
    Field 1: value - String
    Field 2: type - String
    Field 3: time - Unfortunately Strings

    The query will always contain the date range. The query can contain
    all 3
    fields or at least 1 and 3.
    i.e
    1 & 2 & 3
    1 & 3


    I tried creating a BooleanQuery similiar to
    BooleanQuery bq = new BooleanQuery();
    bq.add(new TermQuery(new Term("value",
    "hello")),BooleanClause.Occur.MUST);
    bq.add(new TermQuery(new
    Term("type","email")),BooleanClause.Occur.MUST);

    parallelSearcher.search(bq, new RangeFilter("time", startTime,
    endTime,true,true),col);

    TopDoccollector col = new TopDocCollector(1000);
    ParallelMultiSearcher parallelSearcher = new
    ParallelMultiSearcher(indexes); // 1 to many indexes

    //Now I add the date range
    parallelSearcher.search(bq, new RangeFilter("time", startTime,
    endTime,true,true),col);


    The problem is when there are no matches for the boolean part of the
    query... I get an input/output error...


    java.io.IOException: Input/output error
    java.io.RandomAccessFile.readBytes(Native Method)
    java.io.RandomAccessFile.read(RandomAccessFile.java:315)
    at
    org.apache.lucene.store.FSDirecotry
    $FSIndexInput.readInternal(FSDirectory.java:550)
    at
    org
    .apache
    .lucene.store.BufferedIndexInput.readBytes(BufferedInputInput.java:
    131)
    at
    org.apache.lucene.index.CompoundFileReader
    $CSIndexInput.readInternal(CompoundFileReader.java:240)
    at
    org
    .apache
    .lucene.instoreBufferedIndexInput.refill(BufferedIndexInput.java:
    152)
    at
    org
    .apache
    .lucene.instoreBufferedIndexInput.readByte(BufferedIndexInput.java:
    152)
    at org.lucene.store.IndexInput.readVInt(IndexInput.java:76)
    at org.apache.lucene.index.TermBuffer.read(TermBuffer.java:63)
    at org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:
    123)
    at
    org.apache.lucene.index.SegmentTermEnum.scanTo(SegmentTermEnum.java:
    154)
    at
    org
    .apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:
    223)
    at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:
    217)
    at org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:
    678)
    at org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:
    87)
    at org.apache.lucene.search.Searcher.docFreqs(searcher.java:118)
    at
    org
    .apache.lucene.search.MultiSearcher.createWeight(MultiSearcher.java:
    311)
    at org.apache.lucene.search.Searcher.search(Searcher.java:178)






    Thanks!
    Julie

    --
    View this message in context: http://www.nabble.com/Newbie-Question%3A-Query-Creation-Best-Approach-tp20195065p20195065.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]
    --------------------------
    Grant Ingersoll
    Lucene Boot Camp Training Nov. 3-4, 2008, ApacheCon US New Orleans.
    http://www.lucenebootcamp.com


    Lucene Helpful Hints:
    http://wiki.apache.org/lucene-java/BasicsOfPerformance
    http://wiki.apache.org/lucene-java/LuceneFAQ










    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedOct 27, '08 at 7:56p
activeOct 29, '08 at 12:44p
posts2
users2
websitelucene.apache.org

2 users in discussion

JulieSoko: 1 post Grant Ingersoll: 1 post

People

Translate

site design / logo © 2023 Grokbase