Improved attachment search.
This commit is contained in:
parent
88aa2e7e4d
commit
1298f15b62
3 changed files with 8 additions and 7 deletions
2
test/fixtures/es-normal.txt
vendored
2
test/fixtures/es-normal.txt
vendored
|
@ -1 +1 @@
|
||||||
some normal text
|
some normal text66
|
||||||
|
|
BIN
test/fixtures/es-pdf1.pdf
vendored
Normal file
BIN
test/fixtures/es-pdf1.pdf
vendored
Normal file
Binary file not shown.
|
@ -128,11 +128,12 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# add attachments which should get index / .pdf
|
# add attachments which should get index / .pdf
|
||||||
|
# "Zammad Test77"
|
||||||
Store.add(
|
Store.add(
|
||||||
:object => 'Ticket::Article',
|
:object => 'Ticket::Article',
|
||||||
:o_id => article1.id,
|
:o_id => article1.id,
|
||||||
:data => File.read("#{Rails.root.to_s}/test/fixtures/test1.pdf"),
|
:data => File.read("#{Rails.root.to_s}/test/fixtures/es-pdf1.pdf"),
|
||||||
:filename => 'test1.pdf',
|
:filename => 'es-pdf1.pdf',
|
||||||
:preferences => {},
|
:preferences => {},
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
@ -245,7 +246,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
# search for indexed attachment
|
# search for indexed attachment
|
||||||
result = Ticket.search(
|
result = Ticket.search(
|
||||||
:current_user => agent,
|
:current_user => agent,
|
||||||
:query => 'some AND normal AND text',
|
:query => '"some normal text66"',
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
)
|
)
|
||||||
assert(result[0], 'record 1')
|
assert(result[0], 'record 1')
|
||||||
|
@ -253,7 +254,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
result = Ticket.search(
|
result = Ticket.search(
|
||||||
:current_user => agent,
|
:current_user => agent,
|
||||||
:query => 'otrs.org',
|
:query => 'test77',
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
)
|
)
|
||||||
assert(result[0], 'record 1')
|
assert(result[0], 'record 1')
|
||||||
|
@ -263,14 +264,14 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
||||||
# search for not indexed attachment
|
# search for not indexed attachment
|
||||||
result = Ticket.search(
|
result = Ticket.search(
|
||||||
:current_user => agent,
|
:current_user => agent,
|
||||||
:query => 'some AND too AND big AND text',
|
:query => '"some too big text"',
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
)
|
)
|
||||||
assert(!result[0], 'record 1')
|
assert(!result[0], 'record 1')
|
||||||
|
|
||||||
result = Ticket.search(
|
result = Ticket.search(
|
||||||
:current_user => agent,
|
:current_user => agent,
|
||||||
:query => 'Old AND programmers AND never AND die',
|
:query => '"Old programmers never die"',
|
||||||
:limit => 15,
|
:limit => 15,
|
||||||
)
|
)
|
||||||
assert(!result[0], 'record 1')
|
assert(!result[0], 'record 1')
|
||||||
|
|
Loading…
Reference in a new issue