diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/SearchQueryHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/SearchQueryHandler.java index 8feb00413..ded894f8f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/SearchQueryHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/SearchQueryHandler.java @@ -29,6 +29,7 @@ public class SearchQueryHandler { private OntModel fullModel; private String contextNodeURI; + private int totalInd; //private String query = ""; // private static final String queryForEducationalTraining = "SELECT ?query WHERE {" + @@ -40,6 +41,7 @@ public class SearchQueryHandler { OntModel displayOntModel, ServletContext context) { this.fullModel = ModelContext.getJenaOntModel(context); this.contextNodeURI = contextNodeURI; + this.totalInd = fullModel.listIndividuals().toList().size(); //query = getQueryFromModel(contextNodeURI, displayOntModel); } @@ -644,11 +646,7 @@ public class SearchQueryHandler { return propertyValues.toString(); } - - private int getTotalIndividuals(){ - return fullModel.listIndividuals().toList().size(); - } - + public float calculateBeta(String uri){ float beta=0; RDFNode node = (Resource) fullModel.getResource(uri); @@ -659,7 +657,7 @@ public class SearchQueryHandler { Conn++; } - beta = (float)Conn/getTotalIndividuals(); + beta = (float)Conn/totalInd; beta += 1; return beta; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java index e13b823b3..37f8f2aba 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java @@ -242,17 +242,17 @@ public class Entity2LuceneDoc implements Obj2DocIface{ String contextNodePropertyValues; // if(ent.isVClass("http://xmlns.com/foaf/0.1/Person")){ - contextNodePropertyValues = searchQueryHandler.getPropertiesAssociatedWithEducationalTraining(ent.getURI()); + /*contextNodePropertyValues = searchQueryHandler.getPropertiesAssociatedWithEducationalTraining(ent.getURI()); contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRole(ent.getURI()); contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithPosition(ent.getURI()); contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRelationship(ent.getURI()); contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithAwardReceipt(ent.getURI()); - contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithInformationResource(ent.getURI()); + contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithInformationResource(ent.getURI()); */ // } - Field contextNodeInformation = new Field(term.CONTEXTNODE, contextNodePropertyValues, Field.Store.YES, Field.Index.ANALYZED ); - doc.add(contextNodeInformation); + /* Field contextNodeInformation = new Field(term.CONTEXTNODE, contextNodePropertyValues, Field.Store.YES, Field.Index.ANALYZED ); + doc.add(contextNodeInformation);*/ //Moniker diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java index df0b589eb..873b65175 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java @@ -71,6 +71,9 @@ public class IndividualToSolrDocument implements Obj2DocIface { String classPublicNames = ""; SolrInputDocument doc = new SolrInputDocument(); + float beta = searchQueryHandler.calculateBeta(ent.getURI()); + doc.addField(term.BETA,beta); + //DocId String id = ent.getURI(); log.debug("translating " + id); @@ -152,10 +155,10 @@ public class IndividualToSolrDocument implements Obj2DocIface { value = ent.getLocalName(); } - doc.addField(term.NAME_RAW, value, NAME_BOOST); - doc.addField(term.NAME_LOWERCASE, value.toLowerCase(),NAME_BOOST); - doc.addField(term.NAME_UNSTEMMED, value,NAME_BOOST); - doc.addField(term.NAME_STEMMED, value, NAME_BOOST); + 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)); long tContextNodes = System.currentTimeMillis(); @@ -241,8 +244,8 @@ 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); - doc.addField(term.ALLTEXTUNSTEMMED, value,ALL_TEXT_BOOST); + doc.addField(term.ALLTEXT, value,(ALL_TEXT_BOOST*beta)); + doc.addField(term.ALLTEXTUNSTEMMED, value,(ALL_TEXT_BOOST*beta)); } return doc;