小编dam*_*max的帖子

如何使用React Native PixelRatio实用程序类?

我有一个最初为iPhone 6 symulator编写的应用程序,其中有一个组件,其中包含以下示例值:

const styles = StyleSheet.create({
  headerNav: {
    width: 40,
    height: 40
  },
  headerLogoImage: {
    width: 140,
    height: 140
  },
  footerNavText: {
    padding: 15,
    fontSize: 25
  }
});
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我在iPad symulator上启动应用程序时,大小比例完全崩溃.我知道像PixelRation这样的东西,但文档非常有限且不清楚.

任何想法/建议如何使用此PixelRatio类将这些宽度/高度/填充和fontSize转换为正确的值?

pixel-ratio react-native

9
推荐指数
1
解决办法
4345
查看次数

使用Lucene索引自定义收集器的方式

有人可以帮我解决在Lucene中使用抽象收集器类的自定义实现的方法吗?

我已经实现了两种使用一些测试文本查询索引的方法:

1.总命中数是2.两个文件名都相同,因此结果大小为1,因为我将它们保存在一个集合中.

TopDocs topDocs = searcher.search(query, Integer.MAX_VALUE);
LOG.info("Total hits " + topDocs.totalHits);
ScoreDoc[] scoreDosArray = topDocs.scoreDocs;
for (ScoreDoc scoreDoc : scoreDosArray) {
    Document doc = searcher.doc(scoreDoc.doc);
    String fileName = doc.get(FILENAME_FIELD);
    results.add(fileName);
}
Run Code Online (Sandbox Code Playgroud)

2.CountCollect是eq to 2.我从Collector的collect方法中获取文件名的两个文件都是唯一的,因此最终结果大小也是eq到2. CountNextReader变量在逻辑结尾处是eq到10.

private Set<String> doStreamingSearch(final IndexSearcher searcher, Query query) throws IOException {
    final Set<String> results = new HashSet<String>();
    Collector collector = new Collector() {
        private int base;
        private Scorer scorer;
        private int countCollect;
        private int countNextReader;

        @Override
        public void collect(int doc) throws IOException {
            Document …
Run Code Online (Sandbox Code Playgroud)

lucene

6
推荐指数
1
解决办法
5532
查看次数

标签 统计

lucene ×1

pixel-ratio ×1

react-native ×1