Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lucille to 0.0.1 #134

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ val fs2V = "3.9.2"
val http4sDomV = "0.2.10"
val http4sV = "0.23.23"
val laikaV = "0.19.5"
val lucilleV = "0.0-b9ba3fa-SNAPSHOT"
val lucilleV = "0.0.1"
val munitCatsEffectV = "2.0.0-M3"
val munitV = "1.0.0-M10"
val scalajsDomV = "2.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
package pink.cozydev.protosearch.analysis

import cats.data.NonEmptyList
import cats.syntax.all._
import pink.cozydev.lucille.Query
import pink.cozydev.lucille.Parser
import pink.cozydev.lucille.QueryParser

import pink.cozydev.lucille.MultiQuery

Expand Down Expand Up @@ -115,11 +114,10 @@ case class QueryAnalyzer(

def parse(queryString: String): Either[String, MultiQuery] = {
val q: Either[String, MultiQuery] =
Parser
.parseQ(queryString)
.leftMap(err => s"Parse error before query analysis, err: $err")
QueryParser.parse(queryString)
q.flatMap(mq => mq.qs.traverse(analyzeQ).map(qs => MultiQuery(qs)))
}

}
object QueryAnalyzer {
def apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@

package pink.cozydev.protosearch

import cats.syntax.all._
import pink.cozydev.protosearch.analysis.Analyzer
import pink.cozydev.lucille.Parser
import pink.cozydev.lucille.QueryParser

class BooleanRetrievalSuite extends munit.FunSuite {

val index = CatIndex.index
val analyzer = Analyzer.default

def search(qStr: String): Either[String, Set[Int]] =
Parser
.parseQ(qStr)
.leftMap(_.toString())
QueryParser
.parse(qStr)
.flatMap(q => BooleanRetrieval(index).search(q))

test("Term") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package pink.cozydev.protosearch

import pink.cozydev.protosearch.analysis.Analyzer
import pink.cozydev.lucille.Parser
import pink.cozydev.lucille.QueryParser

class ScorerSuite extends munit.FunSuite {
import BookIndex.{Book, allBooks}
Expand All @@ -34,10 +34,8 @@ class ScorerSuite extends munit.FunSuite {

val scorer = Scorer(index)
def score(q: String, docs: Set[Int]): Either[String, List[(Int, Double)]] =
Parser
.parseQ(q)
.left
.map(_.toString())
QueryParser
.parse(q)
.flatMap(q => scorer.score(q.qs, docs))

def ordered(hits: Either[String, List[(Int, Double)]]): List[Int] =
Expand Down