On Fri, Feb 25, 2011 at 4:27 AM, jvelociter
<platform-notifications(a)xwiki.org> wrote:
Author: jvelociter
Date: 2011-02-25 04:27:58 +0100 (Fri, 25 Feb 2011)
New Revision: 34925
Added:
platform/web/trunk/standard/src/main/webapp/resources/uicomponents/search/searchSuggest.js
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfig.xml
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfigSheet.xml
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestLuceneService.xml
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestSourceClass.xml
Modified:
platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
platform/web/trunk/standard/src/main/webapp/templates/javascript.vm
Log:
XASEARCH-22 Support for multi-sources live suggestions when typing in the search box
XWIKI-6044 Resources for the search suggest feature of search application
First iteration on the "search suggest" feature.
It's not completely finished, though it's functional. It's not activated by
default yet, you can go and activate it in the administration in order to test.
Remains to do :
* Fully internationalize
* Improve suggestion display (show both document title AND document full name)
* Shortcut to open suggestions pages in edit mode (replace jump to page functionnality)
* Other tuning
* Search on both name and title for the document name source
* Fix the attachment name source that does not seem to work
* Filter on blacklisted spaces for non-advanced users
Jerome.
Feedback very welcome.
Modified:
platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
===================================================================
--- platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
2011-02-25 02:31:38 UTC (rev 34924)
+++ platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
2011-02-25 03:27:58 UTC (rev 34925)
@@ -2980,6 +2980,7 @@
dashboard.actions.add.failed=Failed to add gadget:
# Search application resources
+admin.searchsuggest=Search Suggest
admin.search=Search
admin.search.description=Choose the default search engine or configure the Lucene
index.
search.admin.title=Search
Added:
platform/web/trunk/standard/src/main/webapp/resources/uicomponents/search/searchSuggest.js
===================================================================
---
platform/web/trunk/standard/src/main/webapp/resources/uicomponents/search/searchSuggest.js
(rev 0)
+++
platform/web/trunk/standard/src/main/webapp/resources/uicomponents/search/searchSuggest.js
2011-02-25 03:27:58 UTC (rev 34925)
@@ -0,0 +1,213 @@
+var XWiki = (function (XWiki) {
+
+ /**
+ * The search suggest hooks itself on the search input and provide live results as the
user types.
+ * Search form validation is not affected (user can still type enter and get to the
regular search result page)
+ */
+ XWiki.SearchSuggest = Class.create({
+
+ /**
+ * Constructor. Prepares a light modal container on the same model as the
modalPopup
+ * and registers event listerners.
+ */
+ initialize: function(searchInput, sources){
+
+ this.sources = sources;
+
+ this.realSearchInput = $(searchInput);
+
+ this.modalContainer = new Element('div', {'class':
'xdialog-modal-container'}).hide();
+ var screen = new Element('div', {'class':
'xdialog-screen'}).setStyle({
+ opacity : 0.35,
+ backgroundColor : "#000000"
+ });
+ this.modalContainer.insert(screen);
+ this.modalContainer.insert(new Element('div', {'id' :
'searchSuggest'}));
+ document.body.appendChild(this.modalContainer);
+
+ document.observe("xwiki:suggest:clearSuggestions",
this.onClearSuggestions.bindAsEventListener(this));
+ document.observe("xwiki:suggest:containerCreated",
this.onSuggestContainerCreated.bindAsEventListener(this));
+ document.observe("xwiki:suggest:containerPrepared",
this.onSuggestContainerPrepared.bindAsEventListener(this));
+ document.observe("xwiki:suggest:selected",
this.onSuggestionSelected.bindAsEventListener(this));
+
+ this.createSuggest();
+ },
+
+ /**
+ * Callback triggered when the original suggest clears its suggestions.
+ */
+ onClearSuggestions: function(event){
+ if (event.memo.suggest == this.suggest) {
+ this.modalContainer.hide();
+ this.devirtualizeSearchInput();
+ }
+ },
+
+ /**
+ * Callback triggered when the original suggest has prepared its results container.
+ */
+ onSuggestContainerPrepared: function(event){
+ if (event.memo.suggest == this.suggest && event.memo.suggest ==
this.suggest) {
+ this.modalContainer.show();
+ this.virtualizeSearchInput();
+ }
+ },
+
+ /**
+ * Callback triggered when a suggestion is selected.
+ * Submits the form or go to a selected page according to selection.
+ */
+ onSuggestionSelected: function(event) {
+ if (event.memo.suggest = this.suggest) {
+ event.stop();
+ this.onClearSuggestions(event);
+ this.virtualSearchInput.value = event.memo.value;
+ if (!event.memo.id) {
+ // Submit form
+ this.realSearchInput.up('form').submit();
+ }
+ else {
+ // Go to page
+ window.location = event.memo.id;;
+ }
+ }
+ },
+
+ /**
+ * Creates the underlaying suggest widget.
+ */
+ createSuggest: function() {
+ // Create dummy suggestion node to hold the "Show all results" option
+ var valueNode = new Element('div')
+ .insert(new Element('span', {'class':'suggestId'}))
+ .insert(new Element('span',
{'class':'suggestValue'}))
+ .insert(new Element('span',
{'class':'suggestInfo'}))
+ var allResultsNode = new XWiki.widgets.XList([
+ new XWiki.widgets.XListItem( "Show all results...", {
+ 'containerClasses': 'suggestItem',
+ 'classes': 'showAllResuts',
+ 'eventCallbackScope' : this,
+ 'noHighlight' : true,
+ 'value' : valueNode
+ } ),
+ ],
+ {
+ 'classes' : 'suggestList',
+ 'eventListeners' : {
+ 'click': function(event){
+ this.devirtualizeSearchInput();
+ this.realSearchInput.up('form').submit();
+ },
+ 'mouseover':function(event){
+ this.suggest.clearHighlight();
+ this.suggest.iHighlighted = event.element();
+ event.element().addClassName('xhighlight');
+ }
+ }
+ });
+ this.suggest = new XWiki.widgets.Suggest( this.realSearchInput, {
+ parentContainer: $('searchSuggest'),
+ className: 'ajaxsuggest searchSuggest',
+ fadeOnClear:false,
+ align: "right",
+ minchars: 3,
+ sources : this.sources,
+ insertBeforeSuggestions : new Element("div", {'class' :
'results'}).update(allResultsNode.getElement())
+ });
+ },
+
+ /**
+ * Add a "virtual" search input on top of the original one, so that it
appears on top of the modal container.
+ */
+ virtualizeSearchInput: function(){
+ if (!this.isVirtual) {
+ this.isVirtual = true;
+ this.virtualSearchInput.value = this.realSearchInput.value;
+ this.virtualSearchInput.show();
+ this.virtualSearchInput.focus();
+ this.suggest.setInputField(this.virtualSearchInput);
+ }
+ },
+
+ /**
+ * Hides the virtual search input
+ */
+ devirtualizeSearchInput: function(){
+ this.realSearchInput.value = this.virtualSearchInput.value;
+ this.realSearchInput.focus();
+ this.suggest.setInputField(this.realSearchInput);
+ this.isVirtual = false;
+ },
+
+ /**
+ * Callback triggered when the original suggest has created its results container.
+ */
+ onSuggestContainerCreated: function(event){
+ if (event.memo.suggest == this.suggest) {
+ var container = event.memo.container;
+ this.modalContainer.show();
+ this.virtualSearchInput = this.realSearchInput.clone();
+ this.virtualSearchInput.id = this.realSearchInput.id + '-virtual';
+ this.virtualSearchInput.clonePosition(container, { setWidth : false });
+ $('searchSuggest').insert(this.virtualSearchInput);
+ this.virtualSearchInput.setStyle({position : 'absolute'});
+ this.virtualSearchInput.setStyle({
+ top : (this.virtualSearchInput.cumulativeOffset().top -
this.realSearchInput.getHeight()) + 'px',
+ position:'absolute'
+ });
+
+ if (Prototype.Browser.IE || Prototype.Browser.WebKit) {
+ this.virtualSearchInput.observe("keydown",
this.onKeyPress.bindAsEventListener(this));
+ } else {
+ this.virtualSearchInput.observe("keypress",
this.onKeyPress.bindAsEventListener(this));
+ }
+ }
+ },
+
+ /**
+ * Callback triggered when a key has been typed on the virtual input.
+ */
+ onKeyPress: function(event){
+ var key = event.keyCode;
+ switch(key) {
+ // Ignore special keys, which are treated in onKeyPress
+ case Event.KEY_RETURN:
+ if (!this.suggest.hasActiveSelection()) {
+ this.devirtualizeSearchInput();
+ event.stop();
+ this.realSearchInput.up('form').submit();
+ }
+ default:
+ }
+ }
+
+ });
+
+ return XWiki;
+
+})(XWiki);
+
+document.observe("dom:loaded", function(){
+
+ var sources = [
+ ## Iterate over the sources defined in the configuration document, and create a source
array to be passed to the
+ ## search suggest contructor.
+ #set($sourceDocument = $xwiki.getDocument("XWiki.SearchSuggestConfig"))
+ #foreach($source in
$sourceDocument.getObjects('XWiki.SearchSuggestSourceClass'))
+ #if($source.getProperty('activated').value == 1)
+ {
+ name :
"$escapetool.javascript($source.display('name','view'))",
+ varname : 'input',
+ script :
"#evaluate($source.getProperty('url').value)&query=$source.getProperty('query').value&nb=$source.getProperty('resultsNumber').value&",
+ icon : "#evaluate($source.getProperty('icon').value)",
+ highlight: #if($source.getProperty('highlight').value == 1) true #else
false #end
+ },
+ #end
+ #end
+ null // Don't handle last coma. This is going to be compated anyway.
+ ].compact()
+
+ new XWiki.SearchSuggest($('headerglobalsearchinput'), sources);
+
+});
+
Modified: platform/web/trunk/standard/src/main/webapp/templates/javascript.vm
===================================================================
--- platform/web/trunk/standard/src/main/webapp/templates/javascript.vm 2011-02-25
02:31:38 UTC (rev 34924)
+++ platform/web/trunk/standard/src/main/webapp/templates/javascript.vm 2011-02-25
03:27:58 UTC (rev 34925)
@@ -21,6 +21,27 @@
$xwiki.ssfx.use('uicomponents/widgets/notification.css', true)
$xwiki.jsfx.use('uicomponents/widgets/list/xlist.js')
$xwiki.jsfx.use('uicomponents/suggest/suggest.js')
+#if($xwiki.exists('XWiki.SearchSuggestConfig'))
+ ## Hook to request the search suggest script if search suggest configuration is
present.
+ ## We can't just have it as a always-use SSX yet since we compute a hash to be
sure to refresh
+ ## the file when the configuration changes.
+ ## Ideally, this code should be located in a interface extension, in the search
application.
+ #set($searchSuggestConfigDocument =
$xwiki.getDocument('XWiki.SearchSuggestConfig'))
+ #set($searchSuggestConfigObject =
$searchSuggestConfigDocument.getObject('XWiki.SearchSuggestConfig'))
+ #if($searchSuggestConfigObject.getProperty('activated').value == 1)
+ #set($searchSuggestConfigHash = '')
+ #foreach($source in
$searchSuggestConfigDocument.getObjects('XWiki.SearchSuggestSourceClass'))
+ #if($source.getProperty('activated').value == 1)
+ #set($sourceId =
"${source.get('name')}:${source.get('url')}:${source.get('highlight')}:${source.get('icon')}}")
+ #set($searchSuggestConfigHash =
"${searchSuggestConfigHash}|${sourceId}")
+ #end
+ #end
+ $xwiki.jsfx.use('uicomponents/search/searchSuggest.js', {
+ 'forceSkinAction' : true,
+ 'h' : $searchSuggestConfigHash.hashCode()
+ })
+ #end
+#end
<script type="text/javascript"
src="$xwiki.getSkinFile("js/prototype/prototype.js")"></script>
<script type="text/javascript"
src="$xwiki.getSkinFile("js/xwiki/xwiki.js",
true)"></script>
<script type="text/javascript">
Added:
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfig.xml
===================================================================
---
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfig.xml
(rev 0)
+++
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfig.xml
2011-02-25 03:27:58 UTC (rev 34925)
@@ -0,0 +1,960 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xwikidoc>
+<web>XWiki</web>
+<name>SearchSuggestConfig</name>
+<language></language>
+<defaultLanguage>en</defaultLanguage>
+<translation>0</translation>
+<parent>XWiki.SearchCode</parent>
+<creator>XWiki.Admin</creator>
+<author>XWiki.Admin</author>
+<customClass></customClass>
+<contentAuthor>XWiki.Admin</contentAuthor>
+<creationDate>1280310893000</creationDate>
+<date>1298601876000</date>
+<contentUpdateDate>1298601876000</contentUpdateDate>
+<version>1.1</version>
+<title>Search Suggest Configuration</title>
+<template></template>
+<defaultTemplate></defaultTemplate>
+<validationScript></validationScript>
+<comment></comment>
+<minorEdit>false</minorEdit>
+<syntaxId>xwiki/2.0</syntaxId>
+<hidden>false</hidden>
+<class>
+<name>XWiki.SearchSuggestConfig</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<disabled>0</disabled>
+<displayFormType>select</displayFormType>
+<name>activated</name>
+<number>1</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+</class>
+<object>
+<class>
+<name>XWiki.ConfigurableClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<codeToExecute>
+<disabled>0</disabled>
+<editor>---</editor>
+<name>codeToExecute</name>
+<number>7</number>
+<picker>0</picker>
+<prettyName>codeToExecute</prettyName>
+<rows>5</rows>
+<size>40</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
+</codeToExecute>
+<configurationClass>
+<disabled>0</disabled>
+<name>configurationClass</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>configurationClass</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</configurationClass>
+<configureGlobally>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>configureGlobally</name>
+<number>4</number>
+<prettyName>configureGlobally</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</configureGlobally>
+<displayInSection>
+<disabled>0</disabled>
+<name>displayInSection</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>displayInSection</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</displayInSection>
+<heading>
+<disabled>0</disabled>
+<name>heading</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>heading</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</heading>
+<iconAttachment>
+<disabled>0</disabled>
+<name>iconAttachment</name>
+<number>8</number>
+<picker>0</picker>
+<prettyName>iconAttachment</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</iconAttachment>
+<linkPrefix>
+<disabled>0</disabled>
+<name>linkPrefix</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>linkPrefix</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</linkPrefix>
+<propertiesToShow>
+<cache>0</cache>
+<disabled>0</disabled>
+<displayType>input</displayType>
+<multiSelect>1</multiSelect>
+<name>propertiesToShow</name>
+<number>6</number>
+<picker>0</picker>
+<prettyName>propertiesToShow</prettyName>
+<relationalStorage>1</relationalStorage>
+<separator> </separator>
+<separators> ,|</separators>
+<size>20</size>
+<sort>none</sort>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<values></values>
+<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
+</propertiesToShow>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>0</number>
+<className>XWiki.ConfigurableClass</className>
+<guid>322238f5-c742-43ed-81e0-ba169fc05653</guid>
+<property>
+<codeToExecute>[[Configure the suggest
sources>>XWiki.SearchSuggestConfig]]</codeToExecute>
+</property>
+<property>
+<configurationClass>XWiki.SearchSuggestConfig</configurationClass>
+</property>
+<property>
+<configureGlobally>1</configureGlobally>
+</property>
+<property>
+<displayInSection>searchSuggest</displayInSection>
+</property>
+<property>
+<heading>Search Suggest</heading>
+</property>
+<property>
+<iconAttachment></iconAttachment>
+</property>
+<property>
+<linkPrefix></linkPrefix>
+</property>
+<property>
+<propertiesToShow>
+<value>activated</value>
+</propertiesToShow>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestConfig</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<disabled>0</disabled>
+<displayFormType>select</displayFormType>
+<name>activated</name>
+<number>1</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>0</number>
+<className>XWiki.SearchSuggestConfig</className>
+<guid>5faef1df-77ac-4bb3-9dda-8d38447b94e1</guid>
+<property>
+<activated>0</activated>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>0</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>291d9c6d-b9b1-41b2-8aab-5f1cedba5ded</guid>
+<property>
+<activated>1</activated>
+</property>
+<property>
+<highlight>1</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/page_white_text.gif')</icon>
+</property>
+<property>
+<name>Document name</name>
+</property>
+<property>
+<query>name:__INPUT__*</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>1</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>9c2ba119-f8b2-4652-b5ff-9d446cbdb9aa</guid>
+<property>
+<activated>1</activated>
+</property>
+<property>
+<highlight>0</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/page_white_text.gif')</icon>
+</property>
+<property>
+<name>Document content</name>
+</property>
+<property>
+<query>__INPUT__*</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>2</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>40387571-e03f-4ffd-abda-61cf2a2b2b55</guid>
+<property>
+<activated>1</activated>
+</property>
+<property>
+<highlight>1</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/attach.gif')</icon>
+</property>
+<property>
+<name>Attachment name</name>
+</property>
+<property>
+<query>name:__INPUT__* AND type:attachment</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>3</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>dbc05205-6333-4889-8613-83686f9288f6</guid>
+<property>
+<activated>1</activated>
+</property>
+<property>
+<highlight>0</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/attach.gif')</icon>
+</property>
+<property>
+<name>Attachment content</name>
+</property>
+<property>
+<query>__INPUT__*AND type:attachment</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>4</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>1e881b2d-031c-42ba-bd2d-867fa72c7dab</guid>
+<property>
+<activated>0</activated>
+</property>
+<property>
+<highlight>0</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/page_white_picture.gif')</icon>
+</property>
+<property>
+<name>Blog Posts</name>
+</property>
+<property>
+<query>__INPUT__* AND object:Blog.BlogPostClass</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<object>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<name>XWiki.SearchSuggestConfig</name>
+<number>5</number>
+<className>XWiki.SearchSuggestSourceClass</className>
+<guid>8cc7466d-c6be-4118-bb06-8f287a3bad92</guid>
+<property>
+<activated>1</activated>
+</property>
+<property>
+<highlight>0</highlight>
+</property>
+<property>
+<icon>$xwiki.getSkinFile('icons/silk/user.gif')</icon>
+</property>
+<property>
+<name>Users</name>
+</property>
+<property>
+<query>__INPUT__* AND object:XWiki.XWikiUsers</query>
+</property>
+<property>
+<resultsNumber>3</resultsNumber>
+</property>
+<property>
+<url>$xwiki.getURL('XWiki.SearchSuggestLuceneService', 'get',
'outputSyntax=plain')</url>
+</property>
+</object>
+<content>{{include document="XWiki.SearchSuggestConfigSheet" /}}
+</content></xwikidoc>
Added:
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfigSheet.xml
===================================================================
---
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfigSheet.xml
(rev 0)
+++
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestConfigSheet.xml
2011-02-25 03:27:58 UTC (rev 34925)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xwikidoc>
+<web>XWiki</web>
+<name>SearchSuggestConfigSheet</name>
+<language></language>
+<defaultLanguage>en</defaultLanguage>
+<translation>0</translation>
+<parent>XWiki.SearchSuggestConfig</parent>
+<creator>XWiki.Admin</creator>
+<author>XWiki.Admin</author>
+<customClass></customClass>
+<contentAuthor>XWiki.Admin</contentAuthor>
+<creationDate>1280310959000</creationDate>
+<date>1297439261000</date>
+<contentUpdateDate>1297439261000</contentUpdateDate>
+<version>1.1</version>
+<title></title>
+<template></template>
+<defaultTemplate></defaultTemplate>
+<validationScript></validationScript>
+<comment></comment>
+<minorEdit>false</minorEdit>
+<syntaxId>xwiki/2.0</syntaxId>
+<hidden>false</hidden>
+<object>
+<class>
+<name>XWiki.SheetClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<defaultEditMode>
+<disabled>0</disabled>
+<name>defaultEditMode</name>
+<number>1</number>
+<prettyName>Default Edit Mode</prettyName>
+<size>15</size>
+<unmodifiable>0</unmodifiable>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</defaultEditMode>
+</class>
+<name>XWiki.SearchSuggestConfigSheet</name>
+<number>0</number>
+<className>XWiki.SheetClass</className>
+<guid>933b2bea-9566-4352-83ed-0cd9b4fba530</guid>
+<property>
+<defaultEditMode>inline</defaultEditMode>
+</property>
+</object>
+<content>{{velocity}}
+=Search Suggest=
+
+#set($searchSuggestConfigClass =
$xwiki.getDocument("XWiki.SearchSuggestConfig").xWikiClass)
+#set($searchSuggestSourceClassname = "XWiki.SearchSuggestSourceClass")
+#set($configObj = $doc.getObject($doc.fullName))
+**$searchSuggestConfigClass.get("activated").prettyName**:
$doc.display("activated")
+
+== Sources ==
+
+A suggest source is a URL that takes 3 parameters: query, input and nb. The query
parameter must contain a ~_~_INPUT~_~_ placeholder. This URL must process the query with
the given user input and return the result in the XML format expected by the suggest
component.
+
+|= Name |= URL |= Query |= Results Number |= Icon |= Highlight matches |= Activated
+#foreach($srcObj in $doc.getObjects($searchSuggestSourceClassname))|
$doc.display('name', $srcObj) | $doc.display('url', $srcObj) |
#if($context.action == 'view') {{{ #end $doc.display('query', $srcObj)
#if($context.action == 'view') }}} #end | $doc.display('resultsNumber',
$srcObj) | $doc.display('icon', $srcObj) | $doc.display('highlight',
$srcObj) | $doc.display('activated', $srcObj)
+#end
+
+
+#if($context.display == 'edit')
+[[Add a new source>>$doc.getExternalURL('objectadd',
"classname=${searchSuggestSourceClassname}&xredirect=${doc.getURL('inline')}")]]
+#end
+{{/velocity}}</content></xwikidoc>
Added:
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestLuceneService.xml
===================================================================
---
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestLuceneService.xml
(rev 0)
+++
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestLuceneService.xml
2011-02-25 03:27:58 UTC (rev 34925)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xwikidoc>
+<web>XWiki</web>
+<name>SearchSuggestLuceneService</name>
+<language></language>
+<defaultLanguage>en</defaultLanguage>
+<translation>0</translation>
+<parent>XWiki.SearchSuggestConfig</parent>
+<creator>XWiki.Admin</creator>
+<author>XWiki.Admin</author>
+<customClass></customClass>
+<contentAuthor>XWiki.Admin</contentAuthor>
+<creationDate>1280310630000</creationDate>
+<date>1280318001000</date>
+<contentUpdateDate>1280318001000</contentUpdateDate>
+<version>1.1</version>
+<title></title>
+<template></template>
+<defaultTemplate></defaultTemplate>
+<validationScript></validationScript>
+<comment></comment>
+<minorEdit>false</minorEdit>
+<syntaxId>xwiki/2.0</syntaxId>
+<hidden>false</hidden>
+<content>{{velocity}}
+#set($query = "$!request.query")
+#set($input = "$!request.input")
+#set($nb = "$!request.nb")
+#if($nb != '')
+ #set($nb = $util.parseInt($nb) + 1)
+#else
+ #set($nb = 6)
+#end
+#if($query != '' && $input != '')
+ #set($query = $query.replaceAll('__INPUT__', $input))
+ #set($discard = $response.setContentType("text/xml"))
+ <?xml version="1.0" encoding="UTF-8"?>
+ #set($rawresults = $xwiki.lucene.getSearchResults($query, $util.null))
+ #set($results = $rawresults.getResults("0", "$nb"))
+ <results>
+ #foreach($item in $results)
+ #set($itemfullname = "${item.wiki}:${item.space}.${item.name}")
+ #set($itemdoc = $xwiki.getDocument($itemfullname))
+ #if($item.type == "attachment")
+ #set($name = $item.filename)
+ #set($url = $itemdoc.getAttachmentURL($name))
+ #else
+ #set($name = $itemdoc.getDisplayTitle())
+ #set($url = $itemdoc.getURL())
+ #end
+ <rs id="$url"
info="$name">$name</rs>
+ #end
+ </results>
+#else
+{{info}}
+This service allows to retrieve search results for the suggest UI component.
+Examples:
+* [[$doc.getExternalURL('get',
'outputSyntax=plain&query=__INPUT__*&input=test')]]
+{{/info}}
+#end
+{{/velocity}}
+</content></xwikidoc>
Added:
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestSourceClass.xml
===================================================================
---
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestSourceClass.xml
(rev 0)
+++
platform/xwiki-applications/trunk/search/src/main/resources/XWiki/SearchSuggestSourceClass.xml
2011-02-25 03:27:58 UTC (rev 34925)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xwikidoc>
+<web>XWiki</web>
+<name>SearchSuggestSourceClass</name>
+<language></language>
+<defaultLanguage></defaultLanguage>
+<translation>0</translation>
+<parent>XWiki.SearchSuggestConfig</parent>
+<creator>XWiki.Admin</creator>
+<author>XWiki.Admin</author>
+<customClass></customClass>
+<contentAuthor>XWiki.Admin</contentAuthor>
+<creationDate>1280310752000</creationDate>
+<date>1280318001000</date>
+<contentUpdateDate>1280318001000</contentUpdateDate>
+<version>1.1</version>
+<title></title>
+<template></template>
+<defaultTemplate></defaultTemplate>
+<validationScript></validationScript>
+<comment></comment>
+<minorEdit>false</minorEdit>
+<syntaxId>xwiki/2.0</syntaxId>
+<hidden>false</hidden>
+<class>
+<name>XWiki.SearchSuggestSourceClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<activated>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>activated</name>
+<number>7</number>
+<prettyName>activated</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</activated>
+<highlight>
+<defaultValue></defaultValue>
+<disabled>0</disabled>
+<displayFormType>checkbox</displayFormType>
+<displayType></displayType>
+<name>highlight</name>
+<number>6</number>
+<prettyName>highlight</prettyName>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
+</highlight>
+<icon>
+<disabled>0</disabled>
+<name>icon</name>
+<number>5</number>
+<picker>0</picker>
+<prettyName>icon</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</icon>
+<name>
+<disabled>0</disabled>
+<name>name</name>
+<number>1</number>
+<picker>0</picker>
+<prettyName>name</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</name>
+<query>
+<disabled>0</disabled>
+<name>query</name>
+<number>3</number>
+<picker>0</picker>
+<prettyName>query</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</query>
+<resultsNumber>
+<disabled>0</disabled>
+<name>resultsNumber</name>
+<number>4</number>
+<picker>0</picker>
+<prettyName>resultsNumber</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</resultsNumber>
+<url>
+<disabled>0</disabled>
+<name>url</name>
+<number>2</number>
+<picker>0</picker>
+<prettyName>url</prettyName>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<validationMessage></validationMessage>
+<validationRegExp></validationRegExp>
+<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
+</url>
+</class>
+<content>{{include document="XWiki.ClassSheet"/}}
+</content></xwikidoc>
_______________________________________________
notifications mailing list
notifications(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications