Permalink
Browse files

Fix homepage auto-complete : display results sooner, do not trigger i…

…ndexation on non-indexed workspaces.
  • Loading branch information...
1 parent 78c39a9 commit 3050292d24e2c6e55c98df34e394391531dfa6f2 @cdujeu cdujeu committed Jun 29, 2016
@@ -47,6 +47,10 @@
results.push(v);
previousRepo = repoId;
});
+ // Hack : force suggestions display
+ if(this.refs.autosuggest.lastSuggestionsInputValue && this.refs.autosuggest.lastSuggestionsInputValue.indexOf(input) === 0){
+ this.refs.autosuggest.lastSuggestionsInputValue = input;
+ }
callback(null, results);
this.setState({loading:false});
}.bind(this));
@@ -57,7 +61,7 @@
callback(null, []);
return;
}
- bufferCallback('suggestion-loader-search', 150, function(){
+ bufferCallback('suggestion-loader-search', 350, function(){
this.suggestionLoader(input, callback);
}.bind(this));
},
@@ -67,10 +71,16 @@
},
onSuggestionSelected: function(resultNode, event){
+ if(typeof resultNode === "string"){
+ return ;
+ }
pydio.goTo(resultNode);
},
renderSuggestion(resultNode){
+ if(typeof resultNode === "string"){
+ return <span className="groupHeader">{resultNode}</span>;
+ }
if(resultNode.isRoot()){
return <span className="groupHeader">{resultNode.getLabel()}<span className="openicon icon-long-arrow-right"></span></span>;
}else{
@@ -104,7 +114,7 @@
<span className={"suggest-search icon-" + (this.state.loading ? 'refresh rotating' : 'search')}/>
<ReactAutoSuggest
ref="autosuggest"
- cache={true}
+ cache={false}
showWhen = {input => true }
inputAttributes={inputAttributes}
suggestions={this.getSuggestions}
@@ -53,6 +53,7 @@ public function multipleSearch(ServerRequestInterface $requestInterface, Respons
$results->setParentNode(new AJXP_Node($parentContext->getUrlBase()));
$searchParams = $requestInterface->getParsedBody();
$searchParams["limit"] = 5;
+ $searchParams["skip_unindexed"] = "true";
$searchParams["query"] = $searchParams["query"]."*";
foreach($repositories as $repository){
try{
@@ -57,6 +57,10 @@
return excludes.indexOf(user.getId()) == -1;
});
}
+ // Hack : force suggestions display
+ if(this.refs.autosuggest.lastSuggestionsInputValue && this.refs.autosuggest.lastSuggestionsInputValue.indexOf(input) === 0){
+ this.refs.autosuggest.lastSuggestionsInputValue = input;
+ }
callback(null, users);
}.bind(this), this.props.usersOnly, this.props.existingOnly);
},
@@ -164,7 +164,7 @@ public function applyAction(\Psr\Http\Message\ServerRequestInterface $requestInt
try {
$this->loadIndex($ctx, false);
} catch (\Exception $ex) {
- if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
+ if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine() && !isSet($httpVars["skip_unindexed"])) {
$task = \Pydio\Tasks\TaskService::actionAsTask($ctx, "index", []);
$responseInterface = \Pydio\Tasks\TaskService::getInstance()->enqueueTask($task, $requestInterface, $responseInterface);
$x->addChunk(new UserMessage($messages["index.lucene.7"]));
@@ -163,7 +163,7 @@ public function applyAction(\Psr\Http\Message\ServerRequestInterface &$requestIn
} catch (\Exception $ex) {
if ($this->seemsCurrentlyIndexing($ctx, 3)){
$x->addChunk(new UserMessage($messages["index.lucene.11"]));
- }else if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
+ }else if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine() && !isSet($httpVars["skip_unindexed"])) {
$task = \Pydio\Tasks\TaskService::actionAsTask($ctx, "index", []);
$responseInterface = \Pydio\Tasks\TaskService::getInstance()->enqueueTask($task, $requestInterface, $responseInterface);
$x->addChunk(new UserMessage($messages["index.lucene.7"]));

0 comments on commit 3050292

Please sign in to comment.