小编And*_*ndy的帖子

如何在分布式环境中提高Lucene的性能?

在分布式环境中搜索master-shard实现时,我将面临长搜索时间(10秒的顺序).但是,通过Luke的相同查询以毫秒为单位返回.

该应用程序是一个分布式系统.所有节点共享索引所在的公共NFS装载.为简单起见,我们考虑两个节点Node1Node2.该/etc/fstab项目如下.

nfs:/vol/indexes /opt/indexes nfs rw,suid,nodev,rsize=32768,wsize=32768,soft,intr,tcp 0 0
Run Code Online (Sandbox Code Playgroud)

有多个Feed(比如说)Feed1Feed2命中系统,每个节点的每个Feed都有一个分片,每个Feed都有一个分片.索引看起来像

Feed1-master
Feed1-shard-Node1.com
Feed1-shard-Node1.com0
Feed1-shard-Node1.com1
Run Code Online (Sandbox Code Playgroud)

执行搜索的代码是

FeedIndexManager fim = getManager(feedCode);
searcher = fim.getSearcher();
TopDocs docs = searcher.search(q, filter, start + max, sort);

private FeedIndexManager getManager(String feedCode) throws IOException {
  if (!_managers.containsKey(feedCode)) {
    synchronized(_managers) {
      if (!_managers.containsKey(feedCode)) {
        File shard = getShardIndexFile(feedCode);
        File master = getMasterIndexFile(feedCode);
        _managers.put(feedCode, new FeedIndexManager(shard, master));
      }
    }
  }  
  return _managers.get(feedCode);
}
Run Code Online (Sandbox Code Playgroud)

FeedIndexManager如下.

public class FeedIndexManager implements Closeable { …
Run Code Online (Sandbox Code Playgroud)

lucene performance

11
推荐指数
1
解决办法
1727
查看次数

Angularjs绑定数组元素ng-repeat in指令

我正在尝试使用ng-repeat和指令显示数组的元素.指令部分对解决方案很重要.但是,数组的元素未绑定并显示空值.

小提琴可以在http://jsfiddle.net/qrdk9sp5/找到

HTML

<div ng-app="app" ng-controller="testCtrl">
    {{chat.words}}
    <test ng-repeat="word in chat.words"></test>    
</div>
Run Code Online (Sandbox Code Playgroud)

JS

var app = angular.module('app', []);
app.controller("testCtrl", function($scope) {
    $scope.chat = {
        words: [
            'Anencephalous', 'Borborygm', 'Collywobbles'
        ]
    };
});
app.directive('test', function() {
    return {
        restrict: 'EA',
        scope: {
            word: '='
        },
        template: "<li>{{word}}</li>",
        replace: true,
        link: function(scope, elm, attrs) {}
    }
});
Run Code Online (Sandbox Code Playgroud)

OUTPUT

["Anencephalous","Borborygm","Collywobbles"]
•
•
•   
Run Code Online (Sandbox Code Playgroud)

预期产出

["Anencephalous","Borborygm","Collywobbles"]
•Anencephalous
•Borborygm
•Collywobbles   
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助

javascript arrays directive angularjs

2
推荐指数
1
解决办法
574
查看次数

标签 统计

angularjs ×1

arrays ×1

directive ×1

javascript ×1

lucene ×1

performance ×1