Verified Owner
Top Description Methods
org.jabref.logic.search

public Interface SearchBackend

Known Direct Implementers
org.jabref.logic.search.SearchContext, org.jabref.logic.search.inmemory.InMemoryLuceneSearchBackend, org.jabref.logic.search.inmemory.InMemorySearchBackend, org.jabref.logic.search.sqlbased.SqlSearchBackend, org.jabref.logic.search.NoOpSearchBackend
Imports
java.util.List, org.jabref.model.entry.BibEntry, org.jabref.model.entry.event.FieldChangedEvent, org.jabref.model.search.query.SearchQuery, .SearchResults

Implementor role of the GoF Bridge pattern (cf. Design Patterns: Elements of Reusable Object-Oriented Software, Gamma et al., 1994, pp. 151-161).

Concrete implementors plug into SearchContext (the Abstraction) and provide the actual search + indexing behavior. Today: org.jabref.logic.search.sqlbased.SqlSearchBackend (Postgres metadata index + Lucene linked-file index), org.jabref.logic.search.inmemory.InMemorySearchBackend (grammar walk against in-memory entries, no fulltext), and org.jabref.logic.search.inmemory.InMemoryLuceneSearchBackend (grammar walk against in-memory entries plus a Lucene linked-file index).

Method Summary

Modifier and TypeMethod and Description
public void
addToIndex(List<BibEntry> entries)

Indexing lifecycle.

public void
close()

Release backend resources (DB connections, Lucene index handles, …).

public boolean
isEntryMatched(BibEntry entry, SearchQuery query)

Test a single entry against the query without re-running a full library search.

public void
rebuildFullTextIndex()

Re-index linked-file fulltext from scratch.

public void
public SearchResults

Returns:

a SearchResults capturing matched-entry membership and (if supported) fulltext hits.
search
(SearchQuery query)

Run the query against this backend.

public void

Method Detail

addToIndexback to summary
public void addToIndex(List<BibEntry> entries)

Indexing lifecycle. Backends without an index (e.g. in-memory) implement these as no-ops.

closeback to summary
public void close()

Release backend resources (DB connections, Lucene index handles, …). Idempotent.

isEntryMatchedback to summary
public boolean isEntryMatched(BibEntry entry, SearchQuery query)

Test a single entry against the query without re-running a full library search.

rebuildFullTextIndexback to summary
public void rebuildFullTextIndex()

Re-index linked-file fulltext from scratch. Backends without a fulltext index implement as a no-op.

removeFromIndexback to summary
public void removeFromIndex(List<BibEntry> entries)
searchback to summary
public SearchResults search(SearchQuery query)

Run the query against this backend.

Returns:SearchResults

a SearchResults capturing matched-entry membership and (if supported) fulltext hits.

updateEntryback to summary
public void updateEntry(FieldChangedEvent event)