public class ElasticsearchIndex extends AbstractSearchIndex
LuceneSail
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ANALYZER |
static String |
DEFAULT_DOCUMENT_TYPE |
static String |
DEFAULT_INDEX_NAME |
static String |
DOCUMENT_TYPE_KEY |
static String |
ELASTICSEARCH_KEY_PREFIX |
static String |
INDEX_NAME_KEY |
maxDocs
Constructor and Description |
---|
ElasticsearchIndex() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDocument(SearchDocument doc) |
void |
begin()
Begins a transaction.
|
void |
beginReading() |
void |
clear()
Clears the indexes.
|
void |
clearContexts(Resource... contexts)
This should be called from within a begin-commit-rollback block.
|
void |
commit()
Commits any changes done to the LuceneIndex since the last commit.
|
protected SearchDocument |
copyDocument(SearchDocument doc) |
protected void |
deleteDocument(SearchDocument doc) |
void |
endReading() |
String |
getClusterName() |
SearchDocument |
getDocument(Resource subject,
Resource context)
Returns a Document representing the specified Resource & Context
combination, or null when no such Document exists yet.
|
protected SearchDocument |
getDocument(String id)
Returns a Document representing the specified document ID (combination of
resource and context), or null when no such Document exists yet.
|
Iterable<? extends SearchDocument> |
getDocuments(Resource subject)
Returns a list of Documents representing the specified Resource (empty
when no such Document exists yet).
|
protected Iterable<? extends SearchDocument> |
getDocuments(String resourceId) |
String |
getIndexName() |
Map<String,Object> |
getMappings() |
static List<String> |
getPropertyFields(Collection<String> fields)
Filters the given list of fields, retaining all property fields.
|
String[] |
getTypes() |
void |
initialize(Properties parameters) |
protected BulkUpdater |
newBulkUpdate() |
protected SearchDocument |
newDocument(String id,
String resourceId,
String context) |
protected SearchQuery |
parseQuery(String query,
URI propertyURI)
Parse the passed query.
|
void |
rollback() |
org.elasticsearch.search.SearchHits |
search(Resource resource,
org.elasticsearch.action.search.SearchRequestBuilder request,
org.elasticsearch.index.query.QueryBuilder query)
Evaluates the given query only for the given resource.
|
org.elasticsearch.search.SearchHits |
search(org.elasticsearch.action.search.SearchRequestBuilder request,
org.elasticsearch.index.query.QueryBuilder query)
Evaluates the given query and returns the results as a TopDocs instance.
|
void |
shutDown() |
protected void |
updateDocument(SearchDocument doc) |
accept, addDocuments, addRemoveStatements, addStatement, evaluate, getResource, removeStatement
public static final String INDEX_NAME_KEY
public static final String DOCUMENT_TYPE_KEY
public static final String DEFAULT_INDEX_NAME
public static final String DEFAULT_DOCUMENT_TYPE
public static final String DEFAULT_ANALYZER
public static final String ELASTICSEARCH_KEY_PREFIX
public String getClusterName()
public String getIndexName()
public String[] getTypes()
public void initialize(Properties parameters) throws Exception
initialize
in interface SearchIndex
initialize
in class AbstractSearchIndex
Exception
public Map<String,Object> getMappings() throws IOException
IOException
public void shutDown() throws IOException
IOException
protected SearchDocument getDocument(String id) throws IOException
getDocument
in class AbstractSearchIndex
IOException
protected Iterable<? extends SearchDocument> getDocuments(String resourceId) throws IOException
getDocuments
in class AbstractSearchIndex
IOException
protected SearchDocument newDocument(String id, String resourceId, String context)
newDocument
in class AbstractSearchIndex
protected SearchDocument copyDocument(SearchDocument doc)
copyDocument
in class AbstractSearchIndex
protected void addDocument(SearchDocument doc) throws IOException
addDocument
in class AbstractSearchIndex
IOException
protected void updateDocument(SearchDocument doc) throws IOException
updateDocument
in class AbstractSearchIndex
IOException
protected void deleteDocument(SearchDocument doc) throws IOException
deleteDocument
in class AbstractSearchIndex
IOException
protected BulkUpdater newBulkUpdate()
newBulkUpdate
in class AbstractSearchIndex
public SearchDocument getDocument(Resource subject, Resource context) throws IOException
IOException
public Iterable<? extends SearchDocument> getDocuments(Resource subject) throws IOException
IOException
public static List<String> getPropertyFields(Collection<String> fields)
public void begin() throws IOException
SearchIndex
IOException
public void commit() throws IOException
SearchIndex
IOException
public void rollback() throws IOException
IOException
public void beginReading() throws IOException
IOException
public void endReading() throws IOException
IOException
protected SearchQuery parseQuery(String query, URI propertyURI) throws MalformedQueryException
parseQuery
in class AbstractSearchIndex
query
- stringParseException
- when the parsing brakesMalformedQueryException
public org.elasticsearch.search.SearchHits search(Resource resource, org.elasticsearch.action.search.SearchRequestBuilder request, org.elasticsearch.index.query.QueryBuilder query)
public org.elasticsearch.search.SearchHits search(org.elasticsearch.action.search.SearchRequestBuilder request, org.elasticsearch.index.query.QueryBuilder query)
public void clearContexts(Resource... contexts) throws IOException
SearchIndex
contexts
- sail
- - the underlying native sail where to read the missing triples from
after deletionSailException
IOException
public void clear() throws IOException
SearchIndex
IOException
Copyright © 2001-2016 Aduna. All Rights Reserved.