Commit c6507061 authored by Yusei Tahara's avatar Yusei Tahara

2007-12-18 Yusei

* Fixed wrong field names around search dialog.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18396 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68233e9d
......@@ -41,7 +41,7 @@ Multiple arguments:
- arg:all translates into empty tuple, which implies all available values
- state (simulation_state), type (portal_type)
Everything else is treated as SearchableText
Everything else is treated as searchabletext
"""
# XXX score:
......@@ -92,12 +92,12 @@ def parsestates(s):
return s.replace('"','').replace("'","")
def analyze(params):
params['SearchableText']=''
params['searchabletext']=''
params['simulation_state']=simulation_states
def cutter(s):
ss=s.split(':')
if len(ss)==1:
params['SearchableText']+=ss[0]
params['searchabletext']+=ss[0]
if len(ss)==2:
try:
ps=paramsmap.get(ss[0])(ss[1])
......@@ -116,7 +116,7 @@ def parseSearchString(searchstring):
l=r.split(searchstring)
print l
map(analyze(params),l)
params['SearchableText']=params['SearchableText'].strip()
params['searchabletext']=params['searchabletext'].strip()
return params
if __name__=='__main__':
......
......@@ -73,25 +73,25 @@ method.\n
"""\n
req = context.REQUEST\n
\n
search_straight = req.get(\'SearchableText\', \'\')\n
search_straight = req.get(\'searchabletext\', \'\')\n
if search_straight != \'\':\n
return search_straight\n
\n
# words to search in \'any of the words\' form - left intact\n
search_string = req.get(\'SearchableText_any\',\'\')\n
search_string = req.get(\'searchabletext_any\',\'\')\n
\n
# exact phrase to search for - double-quoted\n
search_phrase = req.get(\'SearchableText_phrase\',\'\')\n
search_phrase = req.get(\'searchabletext_phrase\',\'\')\n
if search_phrase != "":\n
search_string += \' "\' + search_phrase + \'"\'\n
\n
# search "with all of the words" - each word prefixed by "+"\n
search_all = req.get(\'SearchableText_all\',\'\')\n
search_all = req.get(\'searchabletext_all\',\'\')\n
if search_all != "":\n
search_string += \' \' + \' \'.join(\'+\' + word for word in search_all.split(\' \'))\n
\n
# search without these words - every word prefixed by "-"\n
search_without = req.get(\'SearchableText_without\',\'\')\n
search_without = req.get(\'searchabletext_without\',\'\')\n
if search_without!="":\n
search_string += \' \' + \' \'.join(\'-\' + word for word in search_without.split(\' \'))\n
\n
......
......@@ -68,7 +68,7 @@
<value> <string encoding="cdata"><![CDATA[
"""\n
The main search script. Receives one big string - a SearchableText, in\n
The main search script. Receives one big string - a searchabletext, in\n
the search syntax, parses the string using external method Base_parseSearchString,\n
then does the following:\n
- processes arguments for searching by any category\n
......@@ -80,17 +80,17 @@ then does the following:\n
"""\n
\n
# if no args we return empty list\n
# we use only SearchableText - all params are passed through this\n
# we use only searchabletext - all params are passed through this\n
\n
# SearchableText can be supplied in request or stored in selection\n
sstr = context.REQUEST.get(\'SearchableText\')\n
# searchabletext can be supplied in request or stored in selection\n
sstr = context.REQUEST.get(\'searchabletext\')\n
\n
if sstr:\n
context.portal_selections.setSelectionParamsFor(\'search_params_selection\', dict(SearchableText=sstr))\n
context.portal_selections.setSelectionParamsFor(\'search_params_selection\', dict(searchabletext=sstr))\n
else:\n
params = context.portal_selections.getSelectionParamsFor(\'search_params_selection\')\n
if params:\n
sstr = params.get(\'SearchableText\')\n
sstr = params.get(\'searchabletext\')\n
\n
if not sstr: return []\n
\n
......@@ -116,13 +116,13 @@ if not args.has_key(\'portal_type\') or args[\'portal_type\'] == ():\n
# args[\'SearchableText\'] = dict(query=args[\'SearchableText\'], search_mode=modemap[mode])\n
\n
# we always do boolean because we want these options in search dialog\n
args[\'SearchableText\'] = dict(query=args[\'SearchableText\'], search_mode=\'in_boolean_mode\')\n
args[\'searchabletext\'] = dict(query=args[\'searchabletext\'], search_mode=\'in_boolean_mode\')\n
\n
# a hack because SQLCatalog wants table.key now \n
# dunno if it is a bug or a feature\n
if args.has_key(\'SearchableText\'):\n
args[\'full_text.SearchableText\'] = args[\'SearchableText\']\n
args.pop(\'SearchableText\')\n
if args.has_key(\'searchabletext\'):\n
args[\'full_text.SearchableText\'] = args[\'searchabletext\']\n
args.pop(\'searchabletext\')\n
\n
cf = args.get(\'creation_from\')\n
ct = args.get(\'creation_to\')\n
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -76,7 +73,7 @@
req = context.REQUEST\n
sstr = context.Base_assembleSearchString()\n
\n
req.set(\'SearchableText\', sstr)\n
req.set(\'searchabletext\', sstr)\n
return context.Base_viewAdvancedSearchResultList()\n
</string> </value>
</item>
......
......@@ -82,10 +82,10 @@ if hasattr(context, \'asText\'):\n
argument_names = (\'advanced_search_text\', \n
\'title\',\n
\'reference\',\n
\'SearchableText\', \n
\'SearchableText_any\',\n
\'SearchableText_all\', \n
\'SearchableText_phrase\',)\n
\'searchabletext\', \n
\'searchabletext_any\',\n
\'searchabletext_all\', \n
\'searchabletext_phrase\',)\n
if selection is not None:\n
params = selection.getParams()\n
else:\n
......@@ -101,7 +101,7 @@ if not search_string:\n
return document_text[:300]\n
\n
search_argument_list = context.Base_parseSearchString(search_string)\n
search_words = search_argument_list.get(\'SearchableText\')\n
search_words = search_argument_list.get(\'searchabletext\')\n
\n
if search_words in (\'\', None,):\n
# the searched words are empty (e.g. because we used only parameters \n
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -94,13 +91,13 @@
<key> <string>left</string> </key>
<value>
<list>
<string>SearchableText_any</string>
<string>SearchableText_all</string>
<string>SearchableText_phrase</string>
<string>SearchableText_without</string>
<string>your_searchabletext_any</string>
<string>your_searchabletext_all</string>
<string>your_searchabletext_phrase</string>
<string>your_searchabletext_without</string>
<string>my_search_portal_type</string>
<string>creation_from</string>
<string>creation_to</string>
<string>your_creation_from</string>
<string>your_creation_to</string>
</list>
</value>
</item>
......@@ -108,11 +105,11 @@
<key> <string>right</string> </key>
<value>
<list>
<string>reference</string>
<string>version</string>
<string>language</string>
<string>mine</string>
<string>newest</string>
<string>your_reference</string>
<string>your_version</string>
<string>your_language</string>
<string>your_mine</string>
<string>your_newest</string>
<string>my_created_within</string>
</list>
</value>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>DateTimeField</string>
</tuple>
<none/>
<global name="DateTimeField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>creation_from</string> </value>
<value> <string>your_creation_from</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>DateTimeField</string>
</tuple>
<none/>
<global name="DateTimeField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>creation_to</string> </value>
<value> <string>your_creation_to</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>ListField</string>
</tuple>
<none/>
<global name="ListField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>language</string> </value>
<value> <string>your_language</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>CheckBoxField</string>
</tuple>
<none/>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mine</string> </value>
<value> <string>your_mine</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>CheckBoxField</string>
</tuple>
<none/>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -20,7 +17,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>newest</string> </value>
<value> <string>your_newest</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>reference</string> </value>
<value> <string>your_reference</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>SearchableText_all</string> </value>
<value> <string>your_searchabletext_all</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>SearchableText_any</string> </value>
<value> <string>your_searchabletext_any</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>SearchableText_phrase</string> </value>
<value> <string>your_searchabletext_phrase</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>SearchableText_without</string> </value>
<value> <string>your_searchabletext_without</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -20,7 +17,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>version</string> </value>
<value> <string>your_version</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -95,7 +95,7 @@
<key> <string>left</string> </key>
<value>
<list>
<string>SearchableText</string>
<string>your_searchabletext</string>
</list>
</value>
</item>
......
......@@ -3,18 +3,15 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>SearchableText</string> </value>
<value> <string>your_searchabletext</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
2007-12-18 Yusei
* Fixed wrong field names around search dialog.
2007-12-11 Yusei
* Fixed dependencies. erp5_dms depends on erp5_crm. Because Document Ingestion Message is based on Event portal type.
......
768
\ No newline at end of file
769
\ No newline at end of file
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