Skip to content

Commit

Permalink
Merge pull request #6333 from tomachalek/fulltext_srch_upd
Browse files Browse the repository at this point in the history
1) Improve query history fulltext search,...
  • Loading branch information
tomachalek authored Oct 24, 2024
2 parents d38191f + b94cd90 commit 69b2a28
Show file tree
Hide file tree
Showing 22 changed files with 855 additions and 142 deletions.
3 changes: 3 additions & 0 deletions lib/action/argmapping/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
class FullSearchArgs:
name: str
any_property_value: str
any_property_value_is_sub: bool
posattr_name: str
posattr_value: str
posattr_value_is_sub: bool
structure_name: str
structattr_name: str
structattr_value: str
structattr_value_is_sub: bool
corpus: str
subcorpus: str
wl_pat: str
Expand Down
23 changes: 17 additions & 6 deletions lib/plugins/ucnk_query_history/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _generate_query_string(

if q_supertype:
parts.append(make_bleve_field('query_supertype', q_supertype))

if full_search_args.name:
parts.append(make_bleve_field('name', full_search_args.name))

Expand All @@ -168,18 +168,29 @@ def _generate_query_string(
parts.append(make_bleve_field('subcorpus', full_search_args.subcorpus))

if full_search_args.any_property_value:
parts.append(make_bleve_field('_all', full_search_args.any_property_value))

parts.append(make_bleve_field(
'_all',
full_search_args.any_property_value,
use_wildcard=full_search_args.any_property_value_is_sub))
else:
if q_supertype in ('conc', 'pquery'):
if full_search_args.posattr_name:
parts.append(make_bleve_field('pos_attr_names', full_search_args.posattr_name))
if full_search_args.posattr_value:
parts.append(make_bleve_field('pos_attr_values', full_search_args.posattr_value))
parts.append(
make_bleve_field(
'pos_attr_values',
full_search_args.posattr_value,
use_wildcard=full_search_args.posattr_value_is_sub))
if full_search_args.structattr_name:
parts.append(make_bleve_field('struct_attr_names', full_search_args.structattr_name))
parts.append(
make_bleve_field('struct_attr_names', full_search_args.structattr_name))
if full_search_args.structattr_value:
parts.append(make_bleve_field('struct_attr_values', full_search_args.structattr_value))
parts.append(
make_bleve_field(
'struct_attr_values',
full_search_args.structattr_value,
use_wildcard=full_search_args.structattr_value_is_sub))

elif q_supertype == 'wlist':
if full_search_args.wl_pat:
Expand Down
29 changes: 16 additions & 13 deletions lib/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,22 @@ async def ajax_query_history(amodel: UserActionModel, req: KRequest, resp: KResp

extended_search = bool(int(req.args.get('extended_search', '0')))
full_search_args = FullSearchArgs(
req.args.get('fsArchivedAs', None),
req.args.get('fsAnyPropertyValue', None),
req.args.get('fsPosattrName', None),
req.args.get('fsPosattrValue', None),
req.args.get('fsStructureName', None),
req.args.get('fsStructattrName', None),
req.args.get('fsStructattrValue', None),
req.args.get('fsCorpus', None),
req.args.get('fsSubcorpus', None),
req.args.get('fsWlpat', None),
req.args.get('fsWattr', None),
req.args.get('fsWlPfilter', None),
req.args.get('fsWlNfilter', None),
name=req.args.get('fsArchivedAs', None),
any_property_value=req.args.get('fsAnyPropertyValue', None),
any_property_value_is_sub=req.args.get('fsAnyPropertyValueIsSub', '0') == '1',
posattr_name=req.args.get('fsPosattrName', None),
posattr_value=req.args.get('fsPosattrValue', None),
posattr_value_is_sub=req.args.get('fsPosattrValueIsSub', '0' == '1'),
structure_name=req.args.get('fsStructureName', None),
structattr_name=req.args.get('fsStructattrName', None),
structattr_value=req.args.get('fsStructattrValue', None),
structattr_value_is_sub=req.args.get('fsStructattrValueIsSub', '0') == '1',
corpus=req.args.get('fsCorpus', None),
subcorpus=req.args.get('fsSubcorpus', None),
wl_pat=req.args.get('fsWlpat', None),
wl_attr=req.args.get('fsWattr', None),
wl_pfilter=req.args.get('fsWlPfilter', None),
wl_nfilter=req.args.get('fsWlNfilter', None),
)

rows = await _load_query_history(
Expand Down
96 changes: 96 additions & 0 deletions public/files/img/back-button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions public/files/img/back-button_s.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 69b2a28

Please sign in to comment.