首页 \ 问答 \ 搜索引擎如何发现平面链接?(How are flat links discovered by a search engine?)

搜索引擎如何发现平面链接?(How are flat links discovered by a search engine?)

我是mod_rewrite新手。 和SEO。 我想创建一个RewriteRule ,它基本上转换了以下请求:

http://xyz.com/property/state/city/name/propertyid/

http://xyz.com/property/?id=propertyid

这是我用过的:

RewriteRule ^property/([^/]+)/([^/]+)/([^/]+)/([1-9][0-9]*)/$ /property/?id=$4 [NC]

正如你所看到的,我不考虑前面的3个参数,只有id就足以显示正确的页面。

现在我想知道的是 - 搜索引擎如何知道属性的“期望”链接? 换句话说,如果要将此页面编入索引,它将在搜索结果中包含哪些链接? (或者这是否取决于我传播的链接?)

谢谢。


I'm new to mod_rewrite. And SEO. I wanted to create a RewriteRule which essentially converts the following request:

http://xyz.com/property/state/city/name/propertyid/

into

http://xyz.com/property/?id=propertyid

This is what I used:

RewriteRule ^property/([^/]+)/([^/]+)/([^/]+)/([1-9][0-9]*)/$ /property/?id=$4 [NC]

As you can see, I don't consider the 3 preceding parameters, the id alone is sufficient to display the right page.

Now what I'm wondering is - how would a search engine know the 'desired' link to the property? In other words, if this page were to be indexed, what link would it have in the search results? (or does this depend on which link I spread around?)

Thanks.


原文:https://stackoverflow.com/questions/6485015
更新时间:2023-03-13 19:03

最满意答案

如果在TryJava8中运行程序,我会得到正确排序的数组。 我想你可能打印输入( fruits ),而不是输出( arrayFruits )。 这就是说,你打开了一个有趣的话题,因为一般来说,你是正确的排序算法并不能保证完整的秩序。 一般来说,对于大型数组,如果两个元素是等价的,但不相同(例如指向等效记录的不同指针),则算法不保证特定的顺序。 这种关系通常被不同的算法分开。

比较方法应该满足顺序关系约束

订单关系应该是:

  • 反身:每个项目都应该与自己相同(我猜你最好回0
  • 不对称:如果A小于或等于BB小于或等于A ,则AB相等。
  • 传递:如果A小于或等于BB小于或等于C ,则A小于或等于C.

大多数排序算法隐含地假定了这个约束(他们不检查它们),因此提供了O(n log n)时间复杂度。 如果条件不成立,则根据算法的实施情况,可以得到不同的结果。

由于并行排序使用MergeSort算法,并且默认排序使用QuickSort算法,因此这两种算法具有不同的行为。

相关主题:大多数排序算法不稳定。 如果两个项目是“相等的”,那么不保证如果A被放置在原始数组中的A'之前,则A将被放置在结果数组中的A'之前。


If one runs the program in TryJava8, I get the correctly sorted array. I think you probably printed the input (fruits) instead of the output (arrayFruits). This said, you opened an interesting topic, since in general, you are right a sorting algorithm does not guarantee the full order. In general for large arrays, if two elements are equivalent, but not the same (for instance a different pointer to an equivalent record), the algorithms do not guarantee a specific order. This said ties are in general broken differently by different algorithms.

A compare method should satisfy the order relation constraints:

An order relation should be:

  • reflexive: every item should be equal to itself (you better return 0 I guess)
  • asymmetrical: if A is less than or equal to B and B is less than or equal to A, A and B are equal.
  • transitive: if A is less than or equal to B and B is less than or equal to C, A is less than or equal to C.

Most of the sorting algorithms assume this constraints implicitly (they don't check them) and thus offer a O(n log n) time complexity. If the condition does not hold, depending on the implementation of the algorithm, one obtains different results.

Since a parallel sort uses the MergeSort algorithm, and a default sort uses the QuickSort algorithm, the two algorithms have different behavior.

A relevant topic: most sorting algorithms are not stable. Say two items are "equal", then it is not guaranteed that if A was placed before A' in the original array, A will be placed before A' in the resulting array.

相关问答

更多
  • API保证了Quicksort不提供的稳定排序。 然而,当按照自然顺序排列原始值时 ,您不会注意到原始值没有身份的区别。 因此,Quicksort用于原始数组,因为它稍微更有效率。 对于您可能会注意到的对象,当根据其equals实现或所提供的Comparator器认为相等的对象更改其顺序时。 因此,Quicksort不是一个选项。 所以使用MergeSort的一个变体,当前的Java版本使用TimSort 。 这同样适用于Arrays.sort和Collections.sort ,尽管使用Java 8, L ...
  • 很可能来自Josh Bloch§: 我写了这些方法,所以我想我有资格回答。 确实没有一个最好的排序算法。 与合并相比,QuickSort有两大缺陷: 它不稳定(如parsifal注)。 它不保证 n log n性能; 它可以降解为病理输入的二次表现。 对于原始类型,稳定性是一个非问题,因为没有与(值)相等性不同的身份概念。 对于Bentely和McIlroy的实施(或随后的Dual Pivot Quicksort ),二次行为的可能性被认为不是一个问题,这就是为什么这些QuickSort变体被用于原始类型。 ...
  • 如果在TryJava8中运行程序,我会得到正确排序的数组。 我想你可能打印输入( fruits ),而不是输出( arrayFruits )。 这就是说,你打开了一个有趣的话题,因为一般来说,你是正确的排序算法并不能保证完整的秩序。 一般来说,对于大型数组,如果两个元素是等价的,但不相同(例如指向等效记录的不同指针),则算法不保证特定的顺序。 这种关系通常被不同的算法分开。 比较方法应该满足顺序关系约束 : 订单关系应该是: 反身:每个项目都应该与自己相同(我猜你最好回0 ) 不对称:如果A小于或等于B且B ...
  • 问题是“Carlos Magno”以Unicode字节顺序标记开头。 如果您将示例文本( [Analise ... Carlos Magno] )复制并粘贴到Unicode Explorer中,您会看到就在Carlos Magno的“C”之前,您已经有了U + FEFF。 基本上,您需要在读取文件时删除它。 最简单的方法就是使用: line = line.replace("\ufeff", ""); ...或先检查: if (line.startsWith("\ufeff")) { line = ...
  • Collection.sort(l)假定Collection.sort(l)的内容是Comparable 。 Collection.sort(1, Comparator)使用自定义比较器来比较l的内容,这就是你所做的。 排序的思路(包括sort()方法)意味着对象必须具有可比性 - 在这种情况下,可以使用Comparable或Comparator 。 请注意,许多Java对象已经可以比较,包括String , Date和Number 。 对于那些,你可以使用Collection.sort(someList) ...
  • 访问数组与访问ArrayList不同。 这是因为这两个对象是根本不同的。 我们来关注这行代码: System.out.println(Arrays.toString(empList) + i + " << First Loop interation"); 您将要为Java 7 API添加书签,以便您可以引用这些方法实际采用的参数。 相信我,从长远来看,这将为您节省大量时间。 具体来说,代码无效,因为toString不接受类型为ArrayList的参数。 你可以直接打印一个ArrayList ,因为它有一个 ...
  • 您传递的Comparator器可能为null 。 Javadoc说: @param c比较器确定列表的顺序。 null值表示应使用元素的自然顺序 。 因此,如果Comparator为null它将假设参数是Comparable 。 Arrays.sort的代码与此一致。 我认为如果Comparator为null ,它应该抛出NPE,但它是方法合同的一部分,所以不能改变。 The Comparator you passed is probably null. The Javadoc states: @param ...
  • 具体的比较取决于内部使用Collections.sort方法对元素进行排序的算法。 根据Javadoc for Collections.sort : 此类中包含的多态算法的文档通常包括实现的简要描述。 这些描述应被视为实施说明,而不是规范的一部分。 只要遵守规范本身,实现者就可以随意替换其他算法。 (例如,sort使用的算法不必是mergesort,但它必须是稳定的。) 换句话说,Java实现可以自由地使用他们喜欢的任何排序算法,只要它以相同的相对顺序保持相同的元素。 这意味着如果不了解您的特定Java实现 ...
  • 它没有理由崩溃或抛出异常。 在实现方法时,您需要履行合同,但如果不这样做,则意味着您将从依赖于它的任何内容中获得任意结果。 没有什么可以用来检查你的实现的正确性,因为这只会减慢一切。 排序算法的效率根据其进行的比较次数来定义。 这意味着它不会仅仅为了检查你的实现是否一致而添加额外的比较,而不仅仅是HashMap将在所有内容上调用.hashcode()两次只是为了检查它两次都会得到相同的结果。 如果碰巧在排序过程中发现问题,那么它可能会抛出异常; 但不要依赖它。 There's no reason for i ...
  • 我试过“比较器”。为简单起见,我的源文件如下 pippo;pluto;paperino casa;terra;cortile primo;secondo;terzo Comparator comparator = new Comparator() { @Override public int compare(String o1, String o2) { return o ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)