Commit 434d0e8f authored by Randall Leeds's avatar Randall Leeds

Get quote for search from the TextQuoteSelector

Now when we track down where the quote property on the target is
coming from (#1207) our search will still work.
parent b25aee93
...@@ -399,8 +399,9 @@ class ViewFilter ...@@ -399,8 +399,9 @@ class ViewFilter
quote: quote:
autofalse: (annotation) -> return annotation.references? autofalse: (annotation) -> return annotation.references?
value: (annotation) -> value: (annotation) ->
for target in (annotation.target or []) for t in (annotation.target or [])
return target.quote if target.quote? for s in (t.selector or []) when s.type is 'TextQuoteSelector'
if s.exact then return s.exact
'' ''
match: (term, value) -> return value.indexOf(term) > -1 match: (term, value) -> return value.indexOf(term) > -1
since: since:
...@@ -478,11 +479,8 @@ class ViewFilter ...@@ -478,11 +479,8 @@ class ViewFilter
# Structure: # Structure:
# [facet_name]: # [facet_name]:
# autofalse: a function for a preliminary false match result # autofalse: a function for a preliminary false match result
# (i.e. if the annotation does not even have a 'text' field, do not try to match the 'text' facet)
# value: a function to extract to facet value for the annotation. # value: a function to extract to facet value for the annotation.
# (i.e. for the quote facet it is the annotation.target.quote from the right target from the annotations)
# match: a function to check if the extracted value matches with the facet value # match: a function to check if the extracted value matches with the facet value
# (i.e. for the text facet it has to check that if the facet is a substring of the annotation.text or not.
# #
# Returns a two-element list: # Returns a two-element list:
# [ # [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment