FAQ
Hi all,
I've always used the MultiFieldQueryParser class without problems but
now i'm experiencing a strange problem.
This is my code:

Map<String, Integer> boost = new HashMap<String, Integer>();
boost.put("field1",5);
boost.put("field2",1);

Analyzer analyzer = new StandardAnalyzer(STOP_WORDS);
String[] s_fields = new String[2];
s_fields[0] = "field1";
s_fields[1] = "field2";
MultiFieldQueryParser mfParser = new
MultiFieldQueryParser(s_fields,analyzer,boost);

try {
query = mfParser.parse(query_string);
} catch(Exception ex) {
System.out.println(ex.getMessage());
}

If I use a query like:
hi all
I'm getting the error: java.lang.Integer
(quite hard to understand!!)

If I use a query like:
field1:hi field1:all field2:hi field2:all
everything works correctly!!

What I'm missing?
Thanks


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

Search Discussions

  • Testn at Aug 3, 2007 at 3:30 pm
    Boost must be Map<String, Float>

    Luca123 wrote:
    Hi all,
    I've always used the MultiFieldQueryParser class without problems but
    now i'm experiencing a strange problem.
    This is my code:

    Map<String, Integer> boost = new HashMap<String, Integer>();
    boost.put("field1",5);
    boost.put("field2",1);

    Analyzer analyzer = new StandardAnalyzer(STOP_WORDS);
    String[] s_fields = new String[2];
    s_fields[0] = "field1";
    s_fields[1] = "field2";
    MultiFieldQueryParser mfParser = new
    MultiFieldQueryParser(s_fields,analyzer,boost);

    try {
    query = mfParser.parse(query_string);
    } catch(Exception ex) {
    System.out.println(ex.getMessage());
    }

    If I use a query like:
    hi all
    I'm getting the error: java.lang.Integer
    (quite hard to understand!!)

    If I use a query like:
    field1:hi field1:all field2:hi field2:all
    everything works correctly!!

    What I'm missing?
    Thanks


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

    --
    View this message in context: http://www.nabble.com/strange-MultiFieldQueryParser-error%3A-java.lang.Integer-tf4212784.html#a11985571
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Luca Rondanini at Aug 3, 2007 at 4:21 pm
    Sometimes I feel stupid! ;)
    Thank you very much!
    Luca


    testn wrote:
    Boost must be Map<String, Float>

    Luca123 wrote:
    Hi all,
    I've always used the MultiFieldQueryParser class without problems but
    now i'm experiencing a strange problem.
    This is my code:

    Map<String, Integer> boost = new HashMap<String, Integer>();
    boost.put("field1",5);
    boost.put("field2",1);

    Analyzer analyzer = new StandardAnalyzer(STOP_WORDS);
    String[] s_fields = new String[2];
    s_fields[0] = "field1";
    s_fields[1] = "field2";
    MultiFieldQueryParser mfParser = new
    MultiFieldQueryParser(s_fields,analyzer,boost);

    try {
    query = mfParser.parse(query_string);
    } catch(Exception ex) {
    System.out.println(ex.getMessage());
    }

    If I use a query like:
    hi all
    I'm getting the error: java.lang.Integer
    (quite hard to understand!!)

    If I use a query like:
    field1:hi field1:all field2:hi field2:all
    everything works correctly!!

    What I'm missing?
    Thanks


    ---------------------------------------------------------------------
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedAug 3, '07 at 2:10p
activeAug 3, '07 at 4:21p
posts3
users2
websitelucene.apache.org

2 users in discussion

Luca Rondanini: 2 posts Testn: 1 post

People

Translate

site design / logo © 2022 Grokbase