-
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.
implement search query on the in-memory index - returning unranked do…
…c ids for now
- Loading branch information
Showing
3 changed files
with
153 additions
and
1 deletion.
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
2 changes: 1 addition & 1 deletion
2
test/information_retrieval_test.exs → test/parsing_indexing_test.exs
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,4 +1,4 @@ | ||
defmodule IRTest do | ||
defmodule IRParseIndexTest do | ||
use ExUnit.Case | ||
|
||
setup do | ||
|
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,46 @@ | ||
defmodule IRSearchTest do | ||
use ExUnit.Case | ||
|
||
setup do | ||
Application.put_env :ir, :data_filepath, "test/data/data.csv" | ||
|
||
{:ok, index, corpus} = IR.indexing(:all, corpus: true) | ||
{:ok, index: index, corpus: corpus} | ||
end | ||
|
||
test "single keyword search - without supplying index/corpus" do | ||
doc_ids = IR.q "art" | ||
assert doc_ids == [4, 5] | ||
end | ||
|
||
test "keywords search - OR boolean", %{index: index, corpus: corpus} do | ||
doc_ids = IR.q "van sdfsdfd eyck", index: index, corpus: corpus | ||
assert doc_ids == [4, 5, 6] | ||
|
||
doc_ids = IR.q "christopher columbus carlo rovelli", index: index, corpus: corpus | ||
assert doc_ids == [1, 7] | ||
end | ||
|
||
test "keywords search - AND boolean", %{index: index, corpus: corpus} do | ||
doc_ids = IR.q "northern renaissance van eyck", index: index, corpus: corpus, op: :and | ||
assert doc_ids == [5, 6] | ||
end | ||
|
||
test "keywords search - 0 results" do | ||
doc_ids = IR.q "sdfdsfsdfsdfsd" | ||
assert doc_ids == [] | ||
|
||
doc_ids = IR.q "sdfsdfd sdfssd sdsdf" | ||
assert doc_ids == [] | ||
|
||
doc_ids = IR.q "van sdfsdfd eyck", op: :and | ||
assert doc_ids == [] | ||
|
||
doc_ids = IR.q "sdfsdfd eyck", op: :and | ||
assert doc_ids == [] | ||
|
||
doc_ids = IR.q "christopher columbus carlo rovelli", op: :and | ||
assert doc_ids == [] | ||
end | ||
|
||
end |