Now "moniker" field is searched too. Previously Moniker was part of ALLTEXT. I think it stands apart. Gave it a field boost of 2F.
This commit is contained in:
parent
96fd80b13f
commit
35a48005b9
2 changed files with 14 additions and 3 deletions
|
@ -691,7 +691,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear
|
||||||
// map.put(Entity2LuceneDoc.term.ALLTEXT,Entity2LuceneDoc.term.ALLTEXTUNSTEMMED);
|
// map.put(Entity2LuceneDoc.term.ALLTEXT,Entity2LuceneDoc.term.ALLTEXTUNSTEMMED);
|
||||||
// qp.setStemmedToUnstemmed(map);
|
// qp.setStemmedToUnstemmed(map);
|
||||||
|
|
||||||
MultiFieldQueryParser qp = new MultiFieldQueryParser(new String[]{"ALLTEXT", "name", "type"}, analyzer);
|
MultiFieldQueryParser qp = new MultiFieldQueryParser(new String[]{"ALLTEXT", "name", "type", "moniker"}, analyzer);
|
||||||
|
|
||||||
return qp;
|
return qp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@ public class Entity2LuceneDoc implements Obj2DocIface{
|
||||||
public static String SUNSET="SUNSET";
|
public static String SUNSET="SUNSET";
|
||||||
/** time of sunrise/start of entity in yyyymmddhhmm */
|
/** time of sunrise/start of entity in yyyymmddhhmm */
|
||||||
public static String SUNRISE="SUNRISE";
|
public static String SUNRISE="SUNRISE";
|
||||||
|
/** entity's moniker */
|
||||||
|
public static String MONIKER="moniker";
|
||||||
/** text for 'full text' search, this is stemmed */
|
/** text for 'full text' search, this is stemmed */
|
||||||
public static String ALLTEXT = "ALLTEXT";
|
public static String ALLTEXT = "ALLTEXT";
|
||||||
/** text for 'full text' search, this is unstemmed for
|
/** text for 'full text' search, this is unstemmed for
|
||||||
|
@ -189,7 +191,7 @@ public class Entity2LuceneDoc implements Obj2DocIface{
|
||||||
value = ent.getLocalName();
|
value = ent.getLocalName();
|
||||||
}
|
}
|
||||||
Field name =new Field(term.NAME, value,
|
Field name =new Field(term.NAME, value,
|
||||||
Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES);
|
Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
|
||||||
name.setBoost( NAME_BOOST );
|
name.setBoost( NAME_BOOST );
|
||||||
doc.add( name );
|
doc.add( name );
|
||||||
|
|
||||||
|
@ -204,6 +206,15 @@ public class Entity2LuceneDoc implements Obj2DocIface{
|
||||||
|
|
||||||
doc.add( new Field(term.NAMERAW, value, Field.Store.YES, Field.Index.NOT_ANALYZED));
|
doc.add( new Field(term.NAMERAW, value, Field.Store.YES, Field.Index.NOT_ANALYZED));
|
||||||
|
|
||||||
|
|
||||||
|
//Moniker
|
||||||
|
|
||||||
|
if(ent.getMoniker() != null){
|
||||||
|
Field moniker = new Field(term.MONIKER, ent.getMoniker(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
|
||||||
|
moniker.setBoost(MONIKER_BOOST);
|
||||||
|
doc.add(moniker);
|
||||||
|
}
|
||||||
|
|
||||||
//boost for entity
|
//boost for entity
|
||||||
if( ent.getSearchBoost() != null && ent.getSearchBoost() != 0 )
|
if( ent.getSearchBoost() != null && ent.getSearchBoost() != 0 )
|
||||||
doc.setBoost(ent.getSearchBoost());
|
doc.setBoost(ent.getSearchBoost());
|
||||||
|
@ -365,6 +376,6 @@ public class Entity2LuceneDoc implements Obj2DocIface{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float NAME_BOOST = 3.0F;
|
public static float NAME_BOOST = 3.0F;
|
||||||
public static float KEYWORD_BOOST = 2.0F;
|
public static float MONIKER_BOOST = 2.0F;
|
||||||
public static float FIELD_BOOST = 1.0F;
|
public static float FIELD_BOOST = 1.0F;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue