diff --git a/solr/homeDirectoryTemplate/conf/schema.xml b/solr/homeDirectoryTemplate/conf/schema.xml index bc5fcad66..25517dd91 100644 --- a/solr/homeDirectoryTemplate/conf/schema.xml +++ b/solr/homeDirectoryTemplate/conf/schema.xml @@ -194,6 +194,9 @@ + + + @@ -217,16 +220,10 @@ - - - - - diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java index af49925fb..c46783f5a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java @@ -3,31 +3,35 @@ package edu.cornell.mannlib.vitro.webapp.search; public class VitroSearchTermNames { + /** Id of entity, vclass or tab */ public static String URI = "URI"; /** search document id */ public static String DOCID = "DocId"; - /** java class of the object that the Doc represents. */ - public static String JCLASS = "JCLASS"; + /** rdf:type */ public static String RDFTYPE = "type"; - /** rdf:type */ - public static String CLASSGROUP_URI = "classgroup"; - /** Modtime from db */ - public static String MODTIME = "modTime"; - + /** class names in human readable form of an individual*/ + public static final String CLASSLOCALNAME = "classLocalName"; + /** classgroups from the individual's rdf:types */ + public static String CLASSGROUP_URI = "classgroup"; + /** Most specific types for individual*/ + public static String MOST_SPECIFIC_TYPE_URIS = "mostSpecificTypeURIs"; + /** time of index in msec since epoc */ public static String INDEXEDTIME= "indexedTime"; + /** text for 'full text' search, this is stemmed */ public static String ALLTEXT = "ALLTEXT"; /** text for 'full text' search, this is unstemmed for * use with wildcards and prefix queries */ - public static String ALLTEXTUNSTEMMED = "ALLTEXTUNSTEMMED"; + public static String ALLTEXTUNSTEMMED = "ALLTEXTUNSTEMMED"; + /** Does the individual have a thumbnail image? 1=yes 0=no */ public static final String THUMBNAIL = "THUMBNAIL"; - /** class names in human readable form of an individual*/ - public static final String CLASSLOCALNAME = "classLocalName"; - + /** download url location for thumbnail */ + public static final String THUMBNAIL_URL = "THUMBNAIL_URL"; + // Fields derived from rdfs:label /** Raw rdfs:label: no lowercasing, no tokenizing, no stop words, no stemming **/ public static String NAME_RAW = "nameRaw"; // @@ -44,6 +48,11 @@ public class VitroSearchTermNames { /** rdfs:label lowercased, tokenized, stop words, stemmed **/ public static String NAME_STEMMED = "nameStemmed"; + + /** preferred title */ + public static final String PREFERRED_TITLE = "PREFERRED_TITLE"; + + public static final String NAME_PHONETIC = "NAME_PHONETIC"; /** rdfs:label lowercased, untokenized, edge-n-gram-filtered for autocomplete on people names **/ public static String AC_NAME_UNTOKENIZED = "acNameUntokenized"; @@ -55,24 +64,13 @@ public class VitroSearchTermNames { /* There is currently no use case for an autocomplete search field that is tokenized but not stemmed. public static String AC_NAME_UNSTEMMED = "acNameUnstemmed"; */ - /** field for beta values of all documents **/ + /** Beta values used in weighting **/ public static final String BETA = "BETA"; - public static final String PHI = "PHI"; - public static final String ADJACENT_NODES = "ADJACENT_NODES"; - - /** adding phonetic field **/ - public static final String ALLTEXT_PHONETIC = "ALLTEXT_PHONETIC"; - public static final String NAME_PHONETIC = "NAME_PHONETIC"; - - /** download url location for thumbnail */ - public static final String THUMBNAIL_URL = "THUMBNAIL_URL"; - - /** source institution url */ + + /** Source institution URL */ public static final String SITE_URL = "siteURL"; - - /** source institution name */ + + /** Source institution name */ public static final String SITE_NAME = "siteName"; - /** preferred title */ - public static final String PREFERRED_TITLE = "PREFERRED_TITLE"; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/IndividualToSolrDocument.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/IndividualToSolrDocument.java index 7c340efde..17cf5e15c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/IndividualToSolrDocument.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/IndividualToSolrDocument.java @@ -69,6 +69,7 @@ public class IndividualToSolrDocument { //add classes, classgroups get if prohibited because of its class StringBuffer classPublicNames = new StringBuffer(""); addClasses(ind, doc, classPublicNames); + addMostSpecificTypeUris( ind, doc ); log.debug(ind.getURI() + " post class boost: " + doc.getDocumentBoost()); @@ -202,7 +203,6 @@ public class IndividualToSolrDocument { doc.addField(term.ALLTEXT, alltext); doc.addField(term.ALLTEXTUNSTEMMED, alltext); - doc.addField(term.ALLTEXT_PHONETIC, alltext); } @@ -256,7 +256,7 @@ public class IndividualToSolrDocument { if( vclasses == null || vclasses.isEmpty() ){ throw new SkipIndividualException("Not indexing because individual has no classes"); } - + for(VClass clz : vclasses){ if(clz.getURI() == null){ continue; @@ -286,6 +286,16 @@ public class IndividualToSolrDocument { } } } + + protected void addMostSpecificTypeUris(Individual ind, SolrInputDocument doc){ + List mstURIs = ind.getMostSpecificTypeURIs(); + if( mstURIs != null ){ + for( String typeURI : mstURIs ){ + if( typeURI != null && ! typeURI.trim().isEmpty() ) + doc.addField(term.MOST_SPECIFIC_TYPE_URIS, typeURI); + } + } + } protected void addLabel(Individual ind, SolrInputDocument doc) { String value = "";