public class SolrUtil extends Object implements WikittySolrConstant
SOLR_ALL_EXTENSIONS, SOLR_EXTENSIONS, SOLR_FULLTEXT, SOLR_FULLTEXT_ALL_EXTENSIONS, SOLR_ID, SOLR_NULL_FIELD, SOLR_QUERY_PARSER, SOLR_WIKITTY_PREFIX, SOLR_WIKITTY_SUFFIX, SUFFIX_BINARY, SUFFIX_BOOLEAN, SUFFIX_DATE, SUFFIX_NUMERIC, SUFFIX_SORTABLE, SUFFIX_STRING, SUFFIX_STRING_FULLTEXT, SUFFIX_STRING_LOWERCASE, SUFFIX_WIKITTY, TREENODE_ATTACHED, TREENODE_ATTACHED_ALL, TREENODE_DEPTH, TREENODE_PARENTS, TREENODE_PREFIX, TREENODE_ROOT| Constructor and Description |
|---|
SolrUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Integer |
convertToInteger(Object value,
String solrFieldName)
Converti un Object en String, si l'objet est de type String un simple
cast est fait, si l'objet est un tableau, on prend le 1er element, si
le tableau contient plus de 1 element une exception est levee
|
static String |
convertToString(Object value,
String solrFieldName)
Converti un Object en String, si l'objet est de type String un simple
cast est fait, si l'objet est un tableau, on prend le 1er element, si
le tableau contient plus de 1 element une exception est levee
|
static Map<String,Object> |
convertToTypedMap(org.apache.solr.common.SolrDocument doc)
Converti un document Solr en une map dont les elements sont types
(les boolean, date, numeric sont convertis dans leur type)
|
static void |
copySolrDocument(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String... fieldToInclude)
Copy solr document
|
static void |
copySolrDocument(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String[] fieldToInclude,
String[] fieldToExclude)
Copy solr document
|
static void |
copySolrDocumentExcludeSomeField(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String... fieldToExclude)
Copy solr document exlude some fields
|
static org.apache.solr.client.solrj.response.QueryResponse |
executeQuery(org.apache.solr.client.solrj.SolrServer solrServer,
org.apache.solr.client.solrj.SolrQuery query)
Execute SolrQuery on specified SolrServer and return the result
|
static Map<String,org.apache.solr.common.SolrDocument> |
findAllByAttachment(org.apache.solr.client.solrj.SolrServer solrServer,
Collection<String> ids)
Find solr document by TreeNode attachment field
|
static Map<String,org.apache.solr.common.SolrDocument> |
findAllByField(org.apache.solr.client.solrj.SolrServer solrServer,
String solrField,
Collection<String> ids)
Find solr document by specified field in argument
|
static Map<String,org.apache.solr.common.SolrDocument> |
findAllById(org.apache.solr.client.solrj.SolrServer solrServer,
Collection<String> ids)
Find solr document by id
|
static Map<String,org.apache.solr.common.SolrDocument> |
findAllByParents(org.apache.solr.client.solrj.SolrServer solrServer,
Collection<String> ids)
Find solr document by TreeNode parents extra field
|
static org.apache.solr.common.SolrDocument |
findById(org.apache.solr.client.solrj.SolrServer solrServer,
String id)
Find solr document by id
|
static Set<String> |
getAttachedTreeNode(org.apache.solr.common.SolrDocument doc)
Recherche tous les TreeNode auquel appartient en Attachment l'objet passe
en parametre
|
static Integer |
getIntFieldValue(org.apache.solr.common.SolrDocument d,
String fieldname)
get value of field in SolrDocument, field must have only one value
|
static Integer |
getIntFieldValue(org.apache.solr.common.SolrDocument d,
String fieldname,
WikittyTypes type)
get value of field in SolrDocument, field must have only one value
|
static Object |
getOneValue(Object value)
If value is collection or array get only the first element, else
juste return value.
|
static String |
getSolrFieldName(String fqfieldName,
WikittyTypes type)
if you change this method, change
FieldModifier.convertToField(org.nuiton.wikitty.services.WikittyTransaction, java.lang.String)
too |
static org.apache.solr.client.solrj.SolrServer |
getSolrServer(org.nuiton.config.ApplicationConfig config) |
static String |
getStringFieldValue(org.apache.solr.common.SolrDocument d,
String fieldname)
get value of field in SolrDocument, field must have only one value
|
static String |
getStringFieldValue(org.apache.solr.common.SolrDocument d,
String fieldname,
WikittyTypes type)
get value of field in SolrDocument, field must have only one value
|
static String |
getStringFieldValue(org.apache.solr.common.SolrInputDocument d,
String fieldname)
get value of field in SolrDocument, field must have only one value
|
static String |
getStringFieldValue(org.apache.solr.common.SolrInputDocument d,
String fieldname,
WikittyTypes type)
get value of field in SolrDocument, field must have only one value
|
static Collection<String> |
getStringFieldValues(org.apache.solr.common.SolrDocument d,
String fieldname) |
static Collection<String> |
getStringFieldValues(org.apache.solr.common.SolrDocument d,
String fieldname,
WikittyTypes type) |
static Collection<String> |
getStringFieldValues(org.apache.solr.common.SolrInputDocument d,
String fieldname) |
static Collection<String> |
getStringFieldValues(org.apache.solr.common.SolrInputDocument d,
String fieldname,
WikittyTypes type) |
static String |
quoteForSolr(String s)
Quote s for solr.
|
public static org.apache.solr.client.solrj.SolrServer getSolrServer(org.nuiton.config.ApplicationConfig config)
public static Set<String> getAttachedTreeNode(org.apache.solr.common.SolrDocument doc)
doc - le document representant l'objetpublic static org.apache.solr.common.SolrDocument findById(org.apache.solr.client.solrj.SolrServer solrServer,
String id)
solrServer - solR serveurid - to findpublic static Map<String,org.apache.solr.common.SolrDocument> findAllById(org.apache.solr.client.solrj.SolrServer solrServer, Collection<String> ids)
solrServer - solR serveurids - to findpublic static Map<String,org.apache.solr.common.SolrDocument> findAllByParents(org.apache.solr.client.solrj.SolrServer solrServer, Collection<String> ids)
solrServer - solR serverids - id that must be find in parents listpublic static Map<String,org.apache.solr.common.SolrDocument> findAllByAttachment(org.apache.solr.client.solrj.SolrServer solrServer, Collection<String> ids)
solrServer - solR serverids - id that must be find in attachment listpublic static Map<String,org.apache.solr.common.SolrDocument> findAllByField(org.apache.solr.client.solrj.SolrServer solrServer, String solrField, Collection<String> ids)
solrServer - solR serveursolrField - field where we looking for idsids - ids that must be in solrFieldpublic static org.apache.solr.client.solrj.response.QueryResponse executeQuery(org.apache.solr.client.solrj.SolrServer solrServer,
org.apache.solr.client.solrj.SolrQuery query)
throws org.apache.solr.client.solrj.SolrServerException
solrServer - solR serverquery - to executeorg.apache.solr.client.solrj.SolrServerException - if exception occured on request executionpublic static Map<String,Object> convertToTypedMap(org.apache.solr.common.SolrDocument doc)
doc - public static String getSolrFieldName(String fqfieldName, WikittyTypes type)
FieldModifier.convertToField(org.nuiton.wikitty.services.WikittyTransaction, java.lang.String)
toofqfieldName - FQ field nametype - of fieldpublic static void copySolrDocument(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String[] fieldToInclude,
String[] fieldToExclude)
source - solr document sourcedest - solr document destinationfieldToInclude - only copy thes fields, if null or empty, copy all fieldfieldToExclude - to not copy these fieldspublic static void copySolrDocument(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String... fieldToInclude)
source - solr document sourcedest - solr document destinationfieldToInclude - only copy this field, if null or empty, copy all fieldpublic static void copySolrDocumentExcludeSomeField(org.apache.solr.common.SolrDocument source,
org.apache.solr.common.SolrInputDocument dest,
String... fieldToExclude)
source - solr document sourcedest - solr document destinationfieldToExclude - not copy these fieldspublic static Collection<String> getStringFieldValues(org.apache.solr.common.SolrDocument d, String fieldname)
public static Collection<String> getStringFieldValues(org.apache.solr.common.SolrInputDocument d, String fieldname)
public static Collection<String> getStringFieldValues(org.apache.solr.common.SolrDocument d, String fieldname, WikittyTypes type)
public static Collection<String> getStringFieldValues(org.apache.solr.common.SolrInputDocument d, String fieldname, WikittyTypes type)
public static String getStringFieldValue(org.apache.solr.common.SolrInputDocument d, String fieldname)
d - fieldname - public static String getStringFieldValue(org.apache.solr.common.SolrInputDocument d, String fieldname, WikittyTypes type)
d - fieldname - type - optional type to generate solr field namepublic static String getStringFieldValue(org.apache.solr.common.SolrDocument d, String fieldname)
d - fieldname - public static String getStringFieldValue(org.apache.solr.common.SolrDocument d, String fieldname, WikittyTypes type)
d - fieldname - type - optional type to generate solr field namepublic static Integer getIntFieldValue(org.apache.solr.common.SolrDocument d, String fieldname)
d - fieldname - public static Integer getIntFieldValue(org.apache.solr.common.SolrDocument d, String fieldname, WikittyTypes type)
d - fieldname - type - optional type to generate solr field namepublic static String convertToString(Object value, String solrFieldName)
value - public static Integer convertToInteger(Object value, String solrFieldName)
value - public static Object getOneValue(Object value)
value - Copyright © 2009–2014 CodeLutin. All rights reserved.