This commit is contained in:
parent
ecca050bbc
commit
7d14c52c12
7 changed files with 30 additions and 16 deletions
|
@ -381,7 +381,7 @@
|
|||
<fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" >
|
||||
<analyzer>
|
||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||
<filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
|
||||
<filter class="solr.PhoneticFilterFactory" encoder="Metaphone" inject="false"/>
|
||||
</analyzer>
|
||||
</fieldtype>
|
||||
|
||||
|
@ -493,9 +493,11 @@
|
|||
<field name="acNameUnstemmed" type="textUnstemmed" indexed="true" stored="false" multiValued="true"/>
|
||||
<field name="acNameStemmed" type="text" indexed="true" stored="false" multiValued="true"/>
|
||||
<field name="indexedTime" type="string" indexed="true" stored="true" multiValued="true"/>
|
||||
<field name="NAME_PHONETIC" type ="phonetic" indexed="true" stored="false" multiValued="true"/>
|
||||
|
||||
<field name="ALLTEXT" type="text" indexed="true" stored="false" multiValued="true"/>
|
||||
<field name="ALLTEXTUNSTEMMED" type="textgen" indexed="true" stored="false" multiValued="true"/>
|
||||
<field name="ALLTEXT_PHONETIC" type="phonetic" indexed="true" stored="false" multiValued="true"/>
|
||||
|
||||
<field name="THUMBNAIL" type="string" indexed="true" stored="true"/>
|
||||
|
||||
|
@ -577,7 +579,7 @@
|
|||
<uniqueKey>DocId</uniqueKey>
|
||||
|
||||
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
||||
<!-- <defaultSearchField>ALLTEXT</defaultSearchField> -->
|
||||
<defaultSearchField>ALLTEXT</defaultSearchField>
|
||||
|
||||
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
||||
<solrQueryParser defaultOperator="AND"/>
|
||||
|
@ -600,7 +602,8 @@
|
|||
<!-- Similarity is the scoring routine for each document vs. a query.
|
||||
A custom similarity may be specified here, but the default is fine
|
||||
for most applications. -->
|
||||
<!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
|
||||
<similarity class="org.apache.lucene.search.DefaultSimilarity"/>
|
||||
<!-- <similarity class="edu.cornell.mannlib.vitro.webapp.search.lucene.CustomSimilarity"/> -->
|
||||
<!-- ... OR ...
|
||||
Specify a SimilarityFactory class name implementation
|
||||
allowing parameters to be used.
|
||||
|
|
|
@ -708,8 +708,9 @@
|
|||
-->
|
||||
<lst name="defaults">
|
||||
<str name="defType">dismax</str>
|
||||
<str name="qf">nameRaw nameLowercase nameUnstemmed nameStemmed ALLTEXT ALLTEXTUNSTEMMED</str>
|
||||
<str name="qf">nameRaw nameLowercase nameUnstemmed nameStemmed ALLTEXT ALLTEXTUNSTEMMED ALLTEXT_PHONETIC NAME_PHONETIC</str>
|
||||
<str name="echoParams">explicit</str>
|
||||
<str name="bf">BETA</str>
|
||||
<int name="rows">10</int>
|
||||
</lst>
|
||||
<!-- In addition to defaults, "appends" params can be specified
|
||||
|
|
|
@ -57,4 +57,8 @@ public class VitroTermNames {
|
|||
|
||||
/** field for beta values of all documents **/
|
||||
public static final String BETA = "BETA";
|
||||
|
||||
/** adding phonetic field **/
|
||||
public static final String ALLTEXT_PHONETIC = "ALLTEXT_PHONETIC";
|
||||
public static final String NAME_PHONETIC = "NAME_PHONETIC";
|
||||
}
|
||||
|
|
|
@ -658,6 +658,7 @@ public class SearchQueryHandler {
|
|||
}
|
||||
|
||||
beta = (float)Conn/totalInd;
|
||||
beta *= 100;
|
||||
beta += 1;
|
||||
return beta;
|
||||
}
|
||||
|
|
|
@ -178,6 +178,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet {
|
|||
SolrServer solr = SolrSetup.getSolrServer(getServletContext());
|
||||
QueryResponse response = null;
|
||||
|
||||
|
||||
try {
|
||||
response = solr.query(query);
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
String classPublicNames = "";
|
||||
SolrInputDocument doc = new SolrInputDocument();
|
||||
|
||||
//float beta = searchQueryHandler.calculateBeta(ent.getURI());
|
||||
//doc.addField(term.BETA,beta);
|
||||
float beta =1;
|
||||
float beta = searchQueryHandler.calculateBeta(ent.getURI());
|
||||
doc.addField(term.BETA,beta);
|
||||
//float beta =1;
|
||||
|
||||
//DocId
|
||||
String id = ent.getURI();
|
||||
|
@ -156,10 +156,11 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
value = ent.getLocalName();
|
||||
}
|
||||
|
||||
doc.addField(term.NAME_RAW, value, (NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_LOWERCASE, value.toLowerCase(),(NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_UNSTEMMED, value,(NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_STEMMED, value, (NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_RAW, value, NAME_BOOST+beta);
|
||||
doc.addField(term.NAME_LOWERCASE, value.toLowerCase(),NAME_BOOST+beta);
|
||||
doc.addField(term.NAME_UNSTEMMED, value,NAME_BOOST+beta);
|
||||
doc.addField(term.NAME_STEMMED, value, NAME_BOOST+beta);
|
||||
doc.addField(term.NAME_PHONETIC, value, PHONETIC_BOOST);
|
||||
|
||||
long tContextNodes = System.currentTimeMillis();
|
||||
|
||||
|
@ -245,8 +246,10 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
|
||||
log.debug("time to include data property statements, object property statements in the index: " + Long.toString(System.currentTimeMillis() - tPropertyStatements));
|
||||
|
||||
doc.addField(term.ALLTEXT, value,(ALL_TEXT_BOOST*beta));
|
||||
doc.addField(term.ALLTEXTUNSTEMMED, value,(ALL_TEXT_BOOST*beta));
|
||||
doc.addField(term.ALLTEXT, value, 4*beta);
|
||||
doc.addField(term.ALLTEXTUNSTEMMED, value, 4*beta);
|
||||
doc.addField(term.ALLTEXT_PHONETIC, value, PHONETIC_BOOST);
|
||||
doc.setDocumentBoost(2*beta);
|
||||
}
|
||||
|
||||
return doc;
|
||||
|
@ -289,7 +292,8 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
return ent;
|
||||
}
|
||||
|
||||
public static float NAME_BOOST = 3.0F;
|
||||
public static float ALL_TEXT_BOOST = 2.0F;
|
||||
public static float NAME_BOOST = 2.0F;
|
||||
public static float PHONETIC_BOOST = 0.1F;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public class SolrIndexer implements IndexerIface {
|
|||
|
||||
@Override
|
||||
public synchronized void index(Individual ind, boolean newDoc) throws IndexingException {
|
||||
|
||||
if( ! indexing )
|
||||
throw new IndexingException("SolrIndexer: must call " +
|
||||
"startIndexing() before index().");
|
||||
|
@ -61,6 +60,7 @@ public class SolrIndexer implements IndexerIface {
|
|||
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
|
||||
docs.add( solrDoc );
|
||||
server.add( docs );
|
||||
|
||||
// if( !newDoc ){
|
||||
// server.add( docs );
|
||||
// log.debug("updated " + ind.getName() + " " + ind.getURI());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue