-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP moving Lucene back out to allow SQLite to be an alternative indexer
- Loading branch information
1 parent
3dcb2b1
commit 31d11c7
Showing
21 changed files
with
212 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package lightdb.index | ||
|
||
import cats.effect.IO | ||
import lightdb.query.Query | ||
import lightdb.{Collection, Document} | ||
|
||
trait IndexSupport[D <: Document[D], IF[F] <: IndexedField[F, D]] extends Collection[D] { | ||
lazy val query: Query[D] = Query(this) | ||
|
||
protected def indexer: Indexer[D] | ||
|
||
override def commit(): IO[Unit] = super.commit().flatMap(_ => indexer.commit()) | ||
|
||
def index: IndexManager[D, IF] | ||
} | ||
|
||
trait IndexManager[D <: Document[D], IF <: IndexedField[_, D]] { | ||
protected var _fields = List.empty[IF] | ||
|
||
def fields: List[IF] = _fields | ||
|
||
protected[lightdb] def register[F, Field <: IF with IndexedField[F, D]](field: Field): Unit = synchronized { | ||
_fields = field :: _fields | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
package lightdb.index | ||
|
||
import lightdb.{Collection, Document} | ||
import org.apache.lucene.search.SortField | ||
import org.apache.lucene.{document => ld} | ||
|
||
trait IndexedField[F, D <: Document[D]] { | ||
def fieldName: String | ||
def collection: Collection[D] | ||
def get: D => F | ||
|
||
collection.index.register(this) | ||
|
||
protected[lightdb] def createFields(doc: D): List[ld.Field] | ||
protected[lightdb] def sortType: SortField.Type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
package lightdb.query | ||
|
||
import lightdb.Document | ||
import org.apache.lucene.search.{Query => LuceneQuery} | ||
|
||
trait Filter[D <: Document[D]] { | ||
protected[lightdb] def asQuery: LuceneQuery | ||
} | ||
|
||
object Filter { | ||
def apply[D <: Document[D]](f: => LuceneQuery): Filter[D] = new Filter[D] { | ||
override protected[lightdb] def asQuery: LuceneQuery = f | ||
} | ||
} | ||
trait Filter[D <: Document[D]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.